Jpp
Classes | Namespaces | Typedefs | Enumerations | Functions | Variables
JColorFacet.hh File Reference
#include <locale>
#include <ostream>
#include <string>
#include <vector>
#include <map>
#include "JLang/JType.hh"
#include "JLang/JTypeList.hh"
#include "JLang/JSinglePointer.hh"
#include "JLang/JException.hh"

Go to the source code of this file.

Classes

struct  JLANG::JColorFacet
 Facet interface to specify text color. More...
 
struct  JLANG::JColorFacetASCII
 Facet class to specify text color for ASCII. More...
 
struct  JLANG::JColorFacetELcode
 Facet class to specify text color for ELcode. More...
 
struct  JLANG::JColorFacetMap_t
 Auxiliary map for color facets. More...
 

Namespaces

 JLANG
 Auxiliary classes and methods for language specific functionality.
 
 JPP
 This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 

Typedefs

typedef JTYPELIST< JColorFacetASCII, JColorFacetELcode >::typelist JLANG::JColorFacetTypes_t
 Typelist of color facets. More...
 

Enumerations

enum  JLANG::JColor_t {
  JLANG::RED, JLANG::GREEN, JLANG::BLUE, JLANG::WHITE,
  JLANG::CYAN, JLANG::PURPLE, JLANG::YELLOW, JLANG::RESET,
  JLANG::BOLD
}
 Enumeration of text colors. More...
 

Functions

std::ostream & operator<< (std::ostream &out, const JLANG::JColor_t color)
 Print color. More...
 

Variables

static const JColorFacetMap_t JLANG::color_facets
 Color facets. More...
 

Function Documentation

◆ operator<<()

std::ostream& operator<< ( std::ostream &  out,
const JLANG::JColor_t  color 
)
inline

Print color.

Parameters
outoutput stream
colorcolor
Returns
output stream

Definition at line 345 of file JColorFacet.hh.

346 {
347  using namespace std;
348  using namespace JPP;
349 
350  const locale& loc = out.getloc();
351 
352  if (has_facet<JColorFacetASCII>(loc))
353  return out << use_facet<JColorFacetASCII> (loc).c_str(color);
354  else if (has_facet<JColorFacetELcode>(loc))
355  return out << use_facet<JColorFacetELcode>(loc).c_str(color);
356  else
357  return out << JColorFacetASCII().c_str(color);
358 }
loc
char * loc(char *orig)
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JLANG::JColorFacetASCII
Facet class to specify text color for ASCII.
Definition: JColorFacet.hh:123
JLANG::JColorFacetASCII::c_str
virtual const char * c_str(const JColor_t color) const
Print color.
Definition: JColorFacet.hh:153
std
Definition: jaanetDictionary.h:36