Text and ANSIColor.
More...
#include <door.h>
|
| Line (const std::string &txt, int width=0) |
|
| Line (const char *txt, int width=0) |
|
| Line (const std::string &txt, int width, ANSIColor c) |
|
| Line (const char *txt, int width, ANSIColor c) |
|
| Line (const std::string &txt, int width, renderFunction rf) |
|
| Line (const char *txt, int width, renderFunction rf) |
|
| Line (const Line &rhs) |
|
| Line (Line &&rhs) |
|
bool | hasRender (void) |
|
int | length (void) |
|
void | fit (void) |
|
void | setPadding (std::string &padstring, ANSIColor padColor) |
|
void | setPadding (const char *padstring, ANSIColor padcolor) |
|
void | setText (std::string &txt) |
|
void | setText (const char *txt) |
|
const char * | getText (void) |
|
void | setColor (ANSIColor c) |
|
void | setRender (renderFunction rf) |
|
void | setUpdater (updateFunction uf) |
|
bool | update (void) |
|
std::string | debug (void) |
|
Text and ANSIColor.
This holds text and ANSIColor information, and knows how to send them out to the Door.
◆ Line() [1/3]
door::Line::Line |
( |
const std::string & |
txt, |
|
|
int |
w = 0 |
|
) |
| |
- Parameters
-
Construct a new Line:: Line object with string and total width.
- Parameters
-
◆ Line() [2/3]
door::Line::Line |
( |
const char * |
txt, |
|
|
int |
w = 0 |
|
) |
| |
Construct a new Line:: Line object with const char * and total width
- Parameters
-
◆ Line() [3/3]
door::Line::Line |
( |
const Line & |
rhs | ) |
|
Construct a new Line:: Line object from an existing Line
- Parameters
-
◆ fit()
void door::Line::fit |
( |
void |
| ) |
|
Make text the given width by padding string with spaces.
- Parameters
-
◆ hasRender()
bool door::Line::hasRender |
( |
void |
| ) |
|
Has a render function been set?
- Returns
- bool
◆ length()
int door::Line::length |
( |
void |
| ) |
|
Return total length of Line
text.length + 2 * padding length
- Returns
- int
◆ setColor()
◆ setPadding() [1/2]
void door::Line::setPadding |
( |
const char * |
padstring, |
|
|
ANSIColor |
padColor |
|
) |
| |
- Parameters
-
set padding (color and text)
- Parameters
-
◆ setPadding() [2/2]
void door::Line::setPadding |
( |
std::string & |
padstring, |
|
|
ANSIColor |
padColor |
|
) |
| |
- Parameters
-
set padding (color and text)
- Parameters
-
◆ setRender()
set render
Set the renderFunction to use for this Line. This replaces the colorizer.
- Parameters
-
◆ setText() [1/2]
void door::Line::setText |
( |
const char * |
txt | ) |
|
Set Line text.
- Parameters
-
◆ setText() [2/2]
void door::Line::setText |
( |
std::string & |
txt | ) |
|
Set Line text.
- Parameters
-
◆ setUpdater()
set updater function
This can update the line text when called.
- Todo:
- Define an updateFunction.
- Parameters
-
◆ update()
bool door::Line::update |
( |
void |
| ) |
|
Call updater, report if the text was actually changed.
- Returns
- bool
◆ operator<<
std::ostream& operator<< |
( |
std::ostream & |
os, |
|
|
const Line & |
l |
|
) |
| |
|
friend |
- Todo:
- This might be a problem, because const Line wouldn't allow me to track "updates". I.E. I send the line, I'd need to change the line's State to "nothing changed". Then, if something did change, the next update request would be able to know that yes, this does indeed need to be sent.
- Bug:
- This also might cause problems if I display a shared BasicLine (in multiple places), and then update it. It would only update in the first place (the others wouldn't show it needs an update).
Output Line
This looks for padding and paddingColor. This uses the render function if set.
- Parameters
-
os | std::ostream |
l | const Line & |
- Returns
- std::ostream&
The documentation for this class was generated from the following files: