Jpp  18.4.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
JLANG::JColorFacetASCII Struct Reference

Facet class to specify text color for ASCII. More...

#include <JColorFacet.hh>

Inheritance diagram for JLANG::JColorFacetASCII:
JLANG::JColorFacet

Public Member Functions

 JColorFacetASCII (std::size_t refs=0)
 Constructor. More...
 
virtual const char * c_str (const JColor_t color) const override
 Print color. More...
 
virtual JColorFacetASCIIclone () const override
 Clone this facet. More...
 

Static Public Member Functions

static const char * getName ()
 Get name of facet. More...
 
static bool is_color (const int color)
 Check color. More...
 
static bool is_bold (const int color)
 Check bold. More...
 
static bool is_reset (const int color)
 Check reset. More...
 

Static Public Attributes

static std::locale::id id
 

Detailed Description

Facet class to specify text color for ASCII.

Definition at line 123 of file JColorFacet.hh.

Constructor & Destructor Documentation

JLANG::JColorFacetASCII::JColorFacetASCII ( std::size_t  refs = 0)
inline

Constructor.

Parameters
refsreference count

Definition at line 142 of file JColorFacet.hh.

142  :
143  JColorFacet(refs)
144  {}
JColorFacet(std::size_t refs=0)
Constructor.
Definition: JColorFacet.hh:57

Member Function Documentation

static const char* JLANG::JColorFacetASCII::getName ( )
inlinestatic

Get name of facet.

Returns
name

Definition at line 131 of file JColorFacet.hh.

132  {
133  return "ASCII";
134  }
virtual const char* JLANG::JColorFacetASCII::c_str ( const JColor_t  color) const
inlineoverridevirtual

Print color.

Parameters
colorcode
Returns
text

Implements JLANG::JColorFacet.

Definition at line 153 of file JColorFacet.hh.

154  {
155  switch (color) {
156  case RED: return "\033[91m";
157  case GREEN: return "\033[92m";
158  case BLUE: return "\033[94m";
159  case WHITE: return "\033[97m";
160  case CYAN: return "\033[96m";
161  case PURPLE: return "\033[95m";
162  case YELLOW: return "\033[93m";
163  case BOLD: return "\033[1m";
164  case RESET: return "\033[0m";
165  default: return "";
166  }
167  }
virtual JColorFacetASCII* JLANG::JColorFacetASCII::clone ( ) const
inlineoverridevirtual

Clone this facet.

Returns
pointer to newly created facet

Implements JLANG::JColorFacet.

Definition at line 175 of file JColorFacet.hh.

176  {
177  return new JColorFacetASCII();
178  }
JColorFacetASCII(std::size_t refs=0)
Constructor.
Definition: JColorFacet.hh:142
static bool JLANG::JColorFacet::is_color ( const int  color)
inlinestaticinherited

Check color.

Parameters
colorcode
Returns
true if color; else false

Definition at line 85 of file JColorFacet.hh.

86  {
87  return !is_bold(color) && !is_reset(color);
88  }
static bool is_bold(const int color)
Check bold.
Definition: JColorFacet.hh:97
static bool is_reset(const int color)
Check reset.
Definition: JColorFacet.hh:109
static bool JLANG::JColorFacet::is_bold ( const int  color)
inlinestaticinherited

Check bold.

Parameters
colorcode
Returns
true if bold; else false

Definition at line 97 of file JColorFacet.hh.

98  {
99  return color == BOLD;
100  }
static bool JLANG::JColorFacet::is_reset ( const int  color)
inlinestaticinherited

Check reset.

Parameters
colorcode
Returns
true if reset; else false

Definition at line 109 of file JColorFacet.hh.

110  {
111  return color == RESET;
112  }

Member Data Documentation

std::locale::id JLANG::JColorFacet::id
staticinherited
Author
mdejong

Definition at line 49 of file JColorFacet.hh.


The documentation for this struct was generated from the following file: