Bugz Door Project
|
Foreground, Background and Attributes. More...
#include <door.h>
Public Member Functions | |
ANSIColor () | |
ANSIColor (ATTR a) | |
ANSIColor (COLOR f) | |
ANSIColor (COLOR f, ATTR a) | |
ANSIColor (COLOR f, ATTR a1, ATTR a2) | |
ANSIColor (COLOR f, COLOR b) | |
ANSIColor (COLOR f, COLOR b, ATTR a) | |
ANSIColor (COLOR f, COLOR b, ATTR a1, ATTR a2) | |
ANSIColor & | Attr (ATTR a) |
bool | operator== (const ANSIColor &c) const |
bool | operator!= (const ANSIColor &c) const |
void | setFg (COLOR f) |
Set foreground color. More... | |
void | setFg (COLOR f, ATTR a) |
Set foreground color and attribute. More... | |
void | setBg (COLOR b) |
Set background color. More... | |
COLOR | getFg () |
COLOR | getBg () |
void | attr (ATTR a) |
Set attribute. More... | |
std::string | output (void) const |
std::string | debug (void) |
Output debug string for ANSIColor. More... | |
std::string | output (ANSIColor &previous) const |
Private Attributes | |
COLOR | fg |
COLOR | bg |
unsigned int | reset: 1 |
unsigned int | bold: 1 |
unsigned int | blink: 1 |
unsigned int | inverse: 1 |
Friends | |
std::ostream & | operator<< (std::ostream &os, const ANSIColor &c) |
Foreground, Background and Attributes.
This holds foreground, background and ANSI-BBS attribute information. The special attribute RESET forces attribute and color output always.
door::ANSIColor::ANSIColor | ( | ) |
Construct a new ANSIColor::ANSIColor object with sensible defaults (White on Black).
door::ANSIColor::ANSIColor | ( | ATTR | a | ) |
Construct a new ANSIColor::ANSIColor object with attribute set.
[in] | a | ATTR |
door::ANSIColor::ANSIColor | ( | COLOR | f | ) |
Construct a new ANSIColor::ANSIColor object with a foreground color.
[in] | f | COLOR |
Construct a new ANSIColor::ANSIColor object with a foreground color and attribute.
[in] | f | COLOR |
[in] | a | ATTR |
Construct a new ANSIColor::ANSIColor object with a foreground color and attributes.
[in] | f | COLOR |
[in] | a1 | ATTR |
[in] | a2 | ATTR |
Construct a new ANSIColor::ANSIColor object with a foreground and background color.
[in] | f | foreground COLOR |
[in] | b | background COLOR |
Construct a new ANSIColor::ANSIColor object with a foreground color, background color, and attribute.
[in] | f | foreground COLOR |
[in] | b | background COLOR |
[in] | a | ATTR |
Construct a new ANSIColor::ANSIColor object with foreground, background color and attributes.
[in] | f | foreground COLOR |
[in] | b | background COLOR |
[in] | a1 | ATTR |
[in] | a2 | ATTR |
void door::ANSIColor::attr | ( | ATTR | a | ) |
Set attribute.
This clears all the attributes before setting the selected ATTR.
[in] | a | ATTR |
std::string door::ANSIColor::debug | ( | void | ) |
Output debug string for ANSIColor.
|
inline |
Get the background color
|
inline |
Get the foreground color
bool door::ANSIColor::operator!= | ( | const ANSIColor & | c | ) | const |
Not-equal operator.
This compares colors and attributes, but ignores reset.
[in] | c | const ANSIColor & |
bool door::ANSIColor::operator== | ( | const ANSIColor & | c | ) | const |
Equal operator.
This compares colors and attributes, but ignores reset.
[in] | c | const ANSIColor & |
std::string door::ANSIColor::output | ( | ANSIColor & | previous | ) | const |
Output only what ANSI attributes and colors have changed. This uses the previous ANSIColor value to determine what has changed.
This sets previous to the current upon completion.
std::string door::ANSIColor::output | ( | void | ) | const |
Output the full ANSI codes for attributes and color. This does not look at the previous values.
void door::ANSIColor::setBg | ( | COLOR | b | ) |
Set background color.
[in] | b | background COLOR |
void door::ANSIColor::setFg | ( | COLOR | f | ) |
Set foreground color.
[in] | f | foreground COLOR |
Set foreground color and attribute.
[in] | f | foreground COLOR |
[in] | a | ATTR |
|
friend |
|
private |
Background color
|
private |
blink slow blinking text
|
private |
bold / bright flag
|
private |
Foreground color
|
private |
inverse
|
private |
reset flag / always send color and attributes