A terminal character decoder which produces pretty HTML markup. More...
#include "TerminalCharacterDecoder.h"
Public Member Functions | |
HTMLDecoder () | |
Constructs an HTML decoder using a default black-on-white color scheme. More... | |
virtual void | begin (QTextStream *output) |
Begin decoding characters. More... | |
virtual void | decodeLine (const Character *const characters, int count, LineProperty properties) |
Converts a line of terminal characters with associated properties into a text string and writes the string into an output QTextStream. More... | |
virtual void | end () |
End decoding. More... | |
void | setColorTable (const ColorEntry *table) |
Sets the colour table which the decoder uses to produce the HTML colour codes in its output. More... | |
Private Member Functions | |
void | closeSpan (QString &text) |
void | openSpan (QString &text, const QString &style) |
Private Attributes | |
const ColorEntry * | _colorTable |
bool | _innerSpanOpen |
CharacterColor | _lastBackColor |
CharacterColor | _lastForeColor |
quint8 | _lastRendition |
QTextStream * | _output |
A terminal character decoder which produces pretty HTML markup.
Definition at line 100 of file TerminalCharacterDecoder.h.
HTMLDecoder::HTMLDecoder | ( | ) |
Constructs an HTML decoder using a default black-on-white color scheme.
Definition at line 88 of file TerminalCharacterDecoder.cpp.
|
virtual |
Begin decoding characters.
The resulting text is appended to output
.
Implements TerminalCharacterDecoder.
Definition at line 97 of file TerminalCharacterDecoder.cpp.
References _output, and openSpan().
|
private |
Definition at line 216 of file TerminalCharacterDecoder.cpp.
Referenced by decodeLine(), and end().
|
virtual |
Converts a line of terminal characters with associated properties into a text string and writes the string into an output QTextStream.
characters | An array of characters of length count . |
properties | Additional properties which affect all characters in the line |
output | The output stream which receives the decoded text |
Implements TerminalCharacterDecoder.
Definition at line 124 of file TerminalCharacterDecoder.cpp.
References _colorTable, _innerSpanOpen, _lastBackColor, _lastForeColor, _lastRendition, _output, Character::backgroundColor, closeSpan(), CharacterColor::color(), Character::foregroundColor, openSpan(), RE_BOLD, RE_UNDERLINE, and Character::rendition.
|
virtual |
End decoding.
Implements TerminalCharacterDecoder.
Definition at line 109 of file TerminalCharacterDecoder.cpp.
References _output, and closeSpan().
|
private |
Definition at line 211 of file TerminalCharacterDecoder.cpp.
Referenced by begin(), and decodeLine().
void HTMLDecoder::setColorTable | ( | const ColorEntry * | table | ) |
Sets the colour table which the decoder uses to produce the HTML colour codes in its output.
Definition at line 221 of file TerminalCharacterDecoder.cpp.
References _colorTable.
|
private |
Definition at line 126 of file TerminalCharacterDecoder.h.
Referenced by decodeLine(), and setColorTable().
|
private |
Definition at line 127 of file TerminalCharacterDecoder.h.
Referenced by decodeLine().
|
private |
Definition at line 130 of file TerminalCharacterDecoder.h.
Referenced by decodeLine().
|
private |
Definition at line 129 of file TerminalCharacterDecoder.h.
Referenced by decodeLine().
|
private |
Definition at line 128 of file TerminalCharacterDecoder.h.
Referenced by decodeLine().
|
private |
Definition at line 125 of file TerminalCharacterDecoder.h.
Referenced by begin(), decodeLine(), and end().