GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
HTMLDecoder Class Reference

A terminal character decoder which produces pretty HTML markup. More...

#include "TerminalCharacterDecoder.h"

Inheritance diagram for HTMLDecoder:
Inheritance graph
[legend]
Collaboration diagram for HTMLDecoder:
Collaboration graph
[legend]

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
 

Detailed Description

A terminal character decoder which produces pretty HTML markup.

Definition at line 100 of file TerminalCharacterDecoder.h.

Constructor & Destructor Documentation

HTMLDecoder::HTMLDecoder ( )

Constructs an HTML decoder using a default black-on-white color scheme.

Definition at line 88 of file TerminalCharacterDecoder.cpp.

Member Function Documentation

void HTMLDecoder::begin ( QTextStream *  output)
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().

void HTMLDecoder::closeSpan ( QString &  text)
private

Definition at line 216 of file TerminalCharacterDecoder.cpp.

Referenced by decodeLine(), and end().

void HTMLDecoder::decodeLine ( const Character *const  characters,
int  count,
LineProperty  properties 
)
virtual

Converts a line of terminal characters with associated properties into a text string and writes the string into an output QTextStream.

Parameters
charactersAn array of characters of length count.
propertiesAdditional properties which affect all characters in the line
outputThe output stream which receives the decoded text

Implements TerminalCharacterDecoder.

Definition at line 124 of file TerminalCharacterDecoder.cpp.

References _colorTable, _innerSpanOpen, _lastBackColor, _lastForeColor, _lastRendition, _output, arg(), Character::backgroundColor, closeSpan(), CharacterColor::color(), Character::foregroundColor, openSpan(), RE_BOLD, RE_UNDERLINE, and Character::rendition.

void HTMLDecoder::end ( )
virtual

End decoding.

Implements TerminalCharacterDecoder.

Definition at line 109 of file TerminalCharacterDecoder.cpp.

References _output, and closeSpan().

void HTMLDecoder::openSpan ( QString &  text,
const QString &  style 
)
private

Definition at line 211 of file TerminalCharacterDecoder.cpp.

References arg().

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.

Member Data Documentation

const ColorEntry* HTMLDecoder::_colorTable
private

Definition at line 126 of file TerminalCharacterDecoder.h.

Referenced by decodeLine(), and setColorTable().

bool HTMLDecoder::_innerSpanOpen
private

Definition at line 127 of file TerminalCharacterDecoder.h.

Referenced by decodeLine().

CharacterColor HTMLDecoder::_lastBackColor
private

Definition at line 130 of file TerminalCharacterDecoder.h.

Referenced by decodeLine().

CharacterColor HTMLDecoder::_lastForeColor
private

Definition at line 129 of file TerminalCharacterDecoder.h.

Referenced by decodeLine().

quint8 HTMLDecoder::_lastRendition
private

Definition at line 128 of file TerminalCharacterDecoder.h.

Referenced by decodeLine().

QTextStream* HTMLDecoder::_output
private

Definition at line 125 of file TerminalCharacterDecoder.h.

Referenced by begin(), decodeLine(), and end().


The documentation for this class was generated from the following files: