Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
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

namespace  JLANG
 Auxiliary classes and methods for language specific functionality.
 
namespace  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.
 

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.
 

Variables

static const JColorFacetMap_t JLANG::color_facets
 Color facets.
 

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 343 of file JColorFacet.hh.

344{
345 using namespace std;
346 using namespace JPP;
347
348 const locale& loc = out.getloc();
349
350 if (has_facet<JColorFacetASCII>(loc))
351 return out << use_facet<JColorFacetASCII> (loc).c_str(color);
352 else if (has_facet<JColorFacetELcode>(loc))
353 return out << use_facet<JColorFacetELcode>(loc).c_str(color);
354 else
355 return out << JColorFacetASCII().c_str(color);
356}
char * loc(char *orig)
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Facet class to specify text color for ASCII.
virtual const char * c_str(const JColor_t color) const override
Print color.