![]() |
Public API Reference |
![]() |
Helper to parse a string for ANSI codes. More...
#include <csutil/ansiparse.h>
Classes | |
struct | CommandParams |
Parameters to ANSI command. More... | |
Public Types | |
enum | Command { cmdUnknown, cmdFormatAttrReset, cmdFormatAttrEnable, cmdFormatAttrDisable, cmdFormatAttrForeground, cmdFormatAttrBackground, cmdClearScreen, cmdClearLine, cmdCursorSetPosition, cmdCursorMoveRelative } |
Identifier for the ANSI command. More... | |
enum | CommandClass { classNone, classUnknown, classFormat, classClear, classCursor } |
Classification of the command sequence. More... | |
enum | FormatAttr { attrBold, attrItalics, attrUnderline, attrBlink, attrReverse, attrStrikethrough, attrDim, attrInvisible } |
Types of attributes in the cmdFormatAttrEnable/cmdFormatAttrBackground command. More... | |
enum | FormatColor { colNone = -1, colBlack, colRed, colGreen, colYellow, colBlue, colMagenta, colCyan, colWhite } |
Values for foreground/background color. More... | |
Static Public Member Functions | |
static bool | DecodeCommand (const char *&cmd, size_t &cmdLen, Command &command, CommandParams &commandParams) |
Decode an ANSI code sequence. | |
static bool | ParseAnsi (const char *str, size_t &ansiCommandLen, CommandClass &cmdClass, size_t &textLen) |
Parse a string for ANSI codes. |
Helper to parse a string for ANSI codes.
Definition at line 33 of file ansiparse.h.
Identifier for the ANSI command.
Definition at line 37 of file ansiparse.h.
Classification of the command sequence.
Definition at line 61 of file ansiparse.h.
Types of attributes in the cmdFormatAttrEnable/cmdFormatAttrBackground command.
Definition at line 78 of file ansiparse.h.
Values for foreground/background color.
colNone |
None specified. |
colBlack |
Black. |
colRed |
Red. |
colGreen |
Green. |
colYellow |
Yellow. |
colBlue |
Blue. |
colMagenta |
Magenta. |
colCyan |
Cyan. |
colWhite |
White. |
Definition at line 98 of file ansiparse.h.
static bool csAnsiParser::DecodeCommand | ( | const char *& | cmd, |
size_t & | cmdLen, | ||
Command & | command, | ||
CommandParams & | commandParams | ||
) | [static] |
Decode an ANSI code sequence.
Decodes a part of an ANSI code sequence, if known.
false
is returned. cmd | String to decode. Updated to point to the start of the next sequence part. |
cmdLen | Returns length of the command in chars. |
command | The decoded command. |
commandParams | Parameters for the decoded command. |
static bool csAnsiParser::ParseAnsi | ( | const char * | str, |
size_t & | ansiCommandLen, | ||
CommandClass & | cmdClass, | ||
size_t & | textLen | ||
) | [static] |
Parse a string for ANSI codes.
Looks if a string contains an ANSI code sequence at the beginning. If yes, the ansiCommandLen parameter is filled with the length of the sequence.
str | String to parse. |
ansiCommandLen | Returns number of chars that the ANSI command takes up. |
cmdClass | Returns the ANSI command class. |
textLen | Contains the number of chars up to the next ANSI sequence or the end of the string if no sequence was found. |