Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
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.
 
virtual const char * c_str (const JColor_t color) const override
 Print color.
 
virtual JColorFacetASCIIclone () const override
 Clone this facet.
 

Static Public Member Functions

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

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

◆ JColorFacetASCII()

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.

Member Function Documentation

◆ getName()

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 }

◆ c_str()

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 }
@ RED
red
@ PURPLE
purple
@ CYAN
cyan
@ RESET
reset
@ YELLOW
yellow
@ WHITE
white
@ GREEN
green
@ BOLD
bold
@ BLUE
blue

◆ clone()

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.

◆ is_color()

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_reset(const int color)
Check reset.
static bool is_bold(const int color)
Check bold.

◆ is_bold()

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 }

◆ is_reset()

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

◆ id

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: