CrystalSpace

Public API Reference

Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

csAnsiParser Class Reference
[Utilities]

Helper to parse a string for ANSI codes. More...

#include <csutil/ansiparse.h>

List of all members.

Public Types

enum  Command {
  cmdUnknown, cmdFormatAttrReset, cmdFormatAttrEnable, cmdFormatAttrDisable,
  cmdFormatAttrForeground, cmdFormatAttrBackground
}
 Identifier for the ANSI command. More...
enum  CommandClass { classNone, classUnknown, classFormat }
 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.

Classes

struct  CommandParams
 Parameters to ANSI command. More...


Detailed Description

Helper to parse a string for ANSI codes.

Definition at line 31 of file ansiparse.h.


Member Enumeration Documentation

enum csAnsiParser::Command
 

Identifier for the ANSI command.

Enumerator:
cmdUnknown  Command was unrecognized.
cmdFormatAttrReset  Reset all attributes.
cmdFormatAttrEnable  'Enable attribute'
cmdFormatAttrDisable  'Disable attribute'
cmdFormatAttrForeground  'Set foreground color'
cmdFormatAttrBackground  'Set background color'

Definition at line 35 of file ansiparse.h.

enum csAnsiParser::CommandClass
 

Classification of the command sequence.

Enumerator:
classNone  No ANSI sequence was found.
classUnknown  An ANSI sequence was found, but not recognized.
classFormat  A formatting sequence was found.

Definition at line 51 of file ansiparse.h.

enum csAnsiParser::FormatAttr
 

Types of attributes in the cmdFormatAttrEnable/cmdFormatAttrBackground command.

Enumerator:
attrBold  'Bold' attribute
attrItalics  'Italics' attribute
attrUnderline  'Underline' attribute
attrBlink  'Blink' attribute
attrReverse  'Reverse' attribute
attrStrikethrough  'Strikethrough' attribute
attrDim  'Dim' attribute
attrInvisible  'Invisible' attribute

Definition at line 64 of file ansiparse.h.

enum csAnsiParser::FormatColor
 

Values for foreground/background color.

Enumerator:
colNone  None specified.
colBlack  Black.
colRed  Red.
colGreen  Green.
colYellow  Yellow.
colBlue  Blue.
colMagenta  Magenta.
colCyan  Cyan.
colWhite  White.

Definition at line 84 of file ansiparse.h.


Member Function Documentation

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. Returns whether the decoding was was successful. cmd is updated to point to the start of the next sequence part.

Remarks:
Multiple sequences might occur, repeated call this function until false is returned.

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. textLen contains the number of chars up to the next ANSI sequence or the end of the string of no sequence is found.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.4.4