GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
HTMLDecoder Class Reference

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

#include "TerminalCharacterDecoder.h"

Inheritance diagram for HTMLDecoder:
Collaboration diagram for HTMLDecoder:

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::HTMLDecoder ( )

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

Definition at line 88 of file TerminalCharacterDecoder.cpp.

Member Function Documentation

◆ begin()

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().

◆ closeSpan()

void HTMLDecoder::closeSpan ( QString &  text)
private

Definition at line 216 of file TerminalCharacterDecoder.cpp.

Referenced by decodeLine(), and end().

◆ decodeLine()

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, Character::backgroundColor, closeSpan(), CharacterColor::color(), Character::foregroundColor, openSpan(), RE_BOLD, RE_UNDERLINE, and Character::rendition.

◆ end()

void HTMLDecoder::end ( )
virtual

End decoding.

Implements TerminalCharacterDecoder.

Definition at line 109 of file TerminalCharacterDecoder.cpp.

References _output, and closeSpan().

◆ openSpan()

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

Definition at line 211 of file TerminalCharacterDecoder.cpp.

Referenced by begin(), and decodeLine().

◆ setColorTable()

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

◆ _colorTable

const ColorEntry* HTMLDecoder::_colorTable
private

Definition at line 126 of file TerminalCharacterDecoder.h.

Referenced by decodeLine(), and setColorTable().

◆ _innerSpanOpen

bool HTMLDecoder::_innerSpanOpen
private

Definition at line 127 of file TerminalCharacterDecoder.h.

Referenced by decodeLine().

◆ _lastBackColor

CharacterColor HTMLDecoder::_lastBackColor
private

Definition at line 130 of file TerminalCharacterDecoder.h.

Referenced by decodeLine().

◆ _lastForeColor

CharacterColor HTMLDecoder::_lastForeColor
private

Definition at line 129 of file TerminalCharacterDecoder.h.

Referenced by decodeLine().

◆ _lastRendition

quint8 HTMLDecoder::_lastRendition
private

Definition at line 128 of file TerminalCharacterDecoder.h.

Referenced by decodeLine().

◆ _output

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: