Bugz Door Project
|
The BBS door project. This is an attempt at writing a C++ BBS door toolkit. More...
Classes | |
class | ANSIColor |
Foreground, Background and Attributes. More... | |
struct | box_styles |
class | Clrscr |
Clear the screen. More... | |
class | ColorOutput |
This holds an ANSIColor and text position + length. More... | |
class | Door |
class | Goto |
ANSI Goto X, Y position. More... | |
class | IConv |
Converts from one encoding to another. Uses iconv (international conversion) API. More... | |
class | Line |
Text and ANSIColor. More... | |
class | Menu |
class | NewLine |
CR+LF. More... | |
class | Panel |
class | Render |
Rendering a string with ANSIColor. More... | |
class | Screen |
Typedefs | |
typedef std::function< Render(const std::string &)> | renderFunction |
Render output function. More... | |
typedef std::function< std::string(void)> | updateFunction |
Enumerations | |
enum | COLOR : std::int8_t { COLOR::BLACK, COLOR::RED, COLOR::GREEN, COLOR::BROWN, COLOR::YELLOW = 3, COLOR::BLUE, COLOR::MAGENTA, COLOR::CYAN, COLOR::WHITE } |
The colors available under ANSI-BBS. More... | |
enum | ATTR : std::int8_t { ATTR::RESET, ATTR::BOLD, ATTR::BRIGHT = 1, ATTR::BLINK = 5, ATTR::INVERSE = 7 } |
ANSI-BBS text attributes. More... | |
enum | Justify { NONE, LEFT, RIGHT, CENTER } |
enum | BorderStyle { BorderStyle::NONE, BorderStyle::SINGLE, BorderStyle::DOUBLE, BorderStyle::SINGLE_DOUBLE, BorderStyle::DOUBLE_SINGLE, BorderStyle::BLANK } |
Functions | |
std::ostream & | operator<< (std::ostream &os, const ANSIColor &c) |
void | to_lower (std::string &text) |
convert string to lowercase More... | |
bool | replace (std::string &str, const std::string &from, const std::string &to) |
Replaces one string with another once. More... | |
bool | replace (std::string &str, const char *from, const char *to) |
Replace all instances of from with to. More... | |
void | sig_handler (int signal) |
Signal handler for detecting hangup/broken pipe. More... | |
void | cp437toUnicode (std::string input, std::string &out) |
Convert from CP437 to unicode. More... | |
void | cp437toUnicode (const char *input, std::string &out) |
Convert from CP437 to unicode. More... | |
std::ostream & | operator<< (std::ostream &os, const Clrscr &clr) |
std::ostream & | operator<< (std::ostream &os, const NewLine &nl) |
std::ostream & | operator<< (std::ostream &os, const Goto &g) |
std::ostream & | operator<< (std::ostream &os, const Line &l) |
std::ostream & | operator<< (std::ostream &os, const Panel &p) |
Output panel to stream. More... | |
std::ostream & | operator<< (std::ostream &os, const Screen &s) |
Outputs screen to stream. More... | |
Variables | |
ANSIColor | reset (ATTR::RESET) |
reset colors to normal More... | |
std::list< char > | pushback |
pushback buffer for keys. More... | |
bool | unicode = false |
Was unicode detected? | |
bool | full_cp437 = false |
Was full CP437 detected? More... | |
bool | debug_capture = false |
Capture the output for debugging. More... | |
Clrscr | cls |
NewLine | nl |
const char | SaveCursor [] = "\x1b[s" |
ANSI Save Cursor position command. | |
const char | RestoreCursor [] = "\x1b[u" |
ANSI Restore Cursor position command. | |
renderFunction | rBlueYellow |
BlueYellow Render example function. More... | |
struct box_styles | UBOXES [] |
Unicode box characters. More... | |
struct box_styles | BOXES [] |
CP437 box characters. More... | |
const char * | JOIN [2][2][2] |
CP437 box line joining data. More... | |
const char * | UJOIN [2][2][2] |
Unicode box line joining data SINGLE 0, DOUBLE 1 Join Border to Line, 0 is Left, 1 is Right. More... | |
The BBS door project. This is an attempt at writing a C++ BBS door toolkit.
typedef std::function<Render(const std::string &)> door::renderFunction |
Render output function.
This defines the render output function. Given the line text, we output the color codes needs to display the line.
typedef std::function<std::string(void)> door::updateFunction |
This defines the update function.
This updates the text.
|
strong |
|
strong |
The different Borders supported by Panel.
Enumerator | |
---|---|
NONE | NONE (0) |
SINGLE | SINGLE (1) |
DOUBLE | DOUBLE (2) |
SINGLE_DOUBLE | SINGLE top DOUBLE side (3) |
DOUBLE_SINGLE | DOUBLE top SINGLE side (4) |
BLANK | BLANK (5) |
|
strong |
|
strong |
void door::cp437toUnicode | ( | const char * | input, |
std::string & | out | ||
) |
Convert from CP437 to unicode.
input | |
out |
void door::cp437toUnicode | ( | std::string | input, |
std::string & | out | ||
) |
Convert from CP437 to unicode.
input | |
out |
std::ostream& door::operator<< | ( | std::ostream & | os, |
const ANSIColor & | c | ||
) |
std::ostream& door::operator<< | ( | std::ostream & | os, |
const Clrscr & | clr | ||
) |
Clear the screen using ANSI codes.
Not all systems home the cursor after clearing the screen. We automatically home the cursor as well.
os | std::ostream& |
clr | const Clrscr& |
std::ostream& door::operator<< | ( | std::ostream & | os, |
const Goto & | g | ||
) |
std::ostream& door::operator<< | ( | std::ostream & | os, |
const Line & | l | ||
) |
std::ostream& door::operator<< | ( | std::ostream & | os, |
const NewLine & | nl | ||
) |
std::ostream& door::operator<< | ( | std::ostream & | os, |
const Panel & | p | ||
) |
Output panel to stream.
This uses the Panel.x, Panel.y to render the panel using ANSI control codes. Border style is considered, and wether or not we are using unicode. Colors of the border, and lines use their color or their renderFunction.
os | |
p |
std::ostream& door::operator<< | ( | std::ostream & | os, |
const Screen & | s | ||
) |
Outputs screen to stream.
This iterates over panels, and outputs them. See door::Panel
[in,out] | os | Stream |
[in] | s | Screen to send |
bool door::replace | ( | std::string & | str, |
const char * | from, | ||
const char * | to | ||
) |
Replace all instances of from with to.
str | |
from | |
to |
bool door::replace | ( | std::string & | str, |
const std::string & | from, | ||
const std::string & | to | ||
) |
Replaces one string with another once.
Returns true if replaced.
[in,out] | str | String to modify |
[in] | from | String to search for |
[in] | to | String to replace with |
void door::sig_handler | ( | int | signal | ) |
Signal handler for detecting hangup/broken pipe.
signal |
void door::to_lower | ( | std::string & | text | ) |
convert string to lowercase
text |
struct box_styles door::BOXES[] |
CP437 box characters.
top-left, top-right, top, side, bottom-left, bottom-right, middle-left, middle-right See BorderStyle for the order the boxes are in.
Clrscr door::cls |
Clear the BBS terminal.
bool door::debug_capture = false |
Capture the output for debugging.
This is used by the tests.
bool door::full_cp437 = false |
Was full CP437 detected?
This is for full CP437 support, meaning it also supports hearts, diamonds, spades, clubs char(3)..char(6). These are sometimes ignored by CP437 translation programs as control codes.
const char* door::JOIN[2][2][2] |
CP437 box line joining data.
SINGLE 0, DOUBLE 1 Join Border to Line, 0 is Left, 1 is Right.
NewLine door::nl |
CRLF
std::list< char > door::pushback |
pushback buffer for keys.
This allows us to peek ahead and push back characters we're not interested it. It also allows us to test the Door::getkey function.
renderFunction door::rBlueYellow |
BlueYellow Render example function.
Example BlueYellow renderFunction.
ANSIColor door::reset |
struct box_styles door::UBOXES[] |
Unicode box characters.
use https://en.wikipedia.org/wiki/Code_page_437 for translations between CP437 and unicode symbols.
This holds the characters needed to render the different box styles. tl tr top side bl br ml mr top-left, top-right, top, side, bottom-left, bottom-right, middle-left, middle-right See BorderStyle for the order the boxes are in.
const char* door::UJOIN[2][2][2] |
Unicode box line joining data SINGLE 0, DOUBLE 1 Join Border to Line, 0 is Left, 1 is Right.