Facet class to specify text color for ELcode.
More...
#include <JColorFacet.hh>
|
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 std::locale::id | id |
|
Facet class to specify text color for ELcode.
Definition at line 185 of file JColorFacet.hh.
◆ JColorFacetELcode()
JLANG::JColorFacetELcode::JColorFacetELcode |
( |
std::size_t | refs = 0 | ) |
|
|
inline |
Constructor.
- Parameters
-
Definition at line 204 of file JColorFacet.hh.
204 :
206 {}
JColorFacet(std::size_t refs=0)
Constructor.
◆ getName()
static const char * JLANG::JColorFacetELcode::getName |
( |
| ) |
|
|
inlinestatic |
Get name of facet.
- Returns
- name
Definition at line 193 of file JColorFacet.hh.
194 {
195 return "ELcode";
196 }
◆ c_str()
virtual const char * JLANG::JColorFacetELcode::c_str |
( |
const JColor_t | color | ) |
const |
|
inlineoverridevirtual |
Print color.
- Parameters
-
- Returns
- text
Implements JLANG::JColorFacet.
Definition at line 215 of file JColorFacet.hh.
216 {
217 static std::string buffer;
218
220
221 switch (color) {
222
223 case RED:
return "[color=red]";
224 case GREEN:
return "[color=green]";
225 case BLUE:
return "[color=blue]";
226 case WHITE:
return "[color=white]";
227 case CYAN:
return "[color=cyan]";
228 case PURPLE:
return "[color=purple]";
229 case YELLOW:
return "[color=yellow]";
230 case BOLD:
return "[bold]";
231
233
234 buffer.clear();
235
236 for (std::vector<int>::const_reverse_iterator i =
history.rbegin(); i !=
history.rend(); ++i) {
238 buffer += "[/color]";
240 buffer += "[/bold]";
241 else
242 ;
243 }
244
246
247 return buffer.c_str();
248
249 default: return "";
250 }
251 }
std::vector< int > history
static bool is_color(const int color)
Check color.
static bool is_bold(const int color)
Check bold.
◆ clone()
Clone this facet.
- Returns
- pointer to newly created facet
Implements JLANG::JColorFacet.
Definition at line 259 of file JColorFacet.hh.
260 {
262 }
JColorFacetELcode(std::size_t refs=0)
Constructor.
◆ is_color()
static bool JLANG::JColorFacet::is_color |
( |
const int | color | ) |
|
|
inlinestaticinherited |
Check color.
- Parameters
-
- Returns
- true if color; else false
Definition at line 85 of file JColorFacet.hh.
86 {
88 }
static bool is_reset(const int color)
Check reset.
◆ is_bold()
static bool JLANG::JColorFacet::is_bold |
( |
const int | color | ) |
|
|
inlinestaticinherited |
Check bold.
- Parameters
-
- Returns
- true if bold; else false
Definition at line 97 of file JColorFacet.hh.
◆ is_reset()
static bool JLANG::JColorFacet::is_reset |
( |
const int | color | ) |
|
|
inlinestaticinherited |
Check reset.
- Parameters
-
- Returns
- true if reset; else false
Definition at line 109 of file JColorFacet.hh.
110 {
111 return color ==
RESET;
112 }
◆ history
◆ id
std::locale::id JLANG::JColorFacet::id |
|
staticinherited |
The documentation for this struct was generated from the following file: