1 /* 2 SPDX-FileCopyrightText: 2006-2008 Robert Knight <robertknight@gmail.com> 3 4 SPDX-License-Identifier: GPL-2.0-or-later 5 */ 6 7 #ifndef TERMINAL_CHARACTER_DECODER_H 8 #define TERMINAL_CHARACTER_DECODER_H 9 10 // Qt 11 #include <QExplicitlySharedDataPointer> 12 #include <QList> 13 14 // Konsole characters 15 #include <Character.h> 16 17 // Konsole decoders 18 #include "konsoledecoders_export.h" 19 20 class QTextStream; 21 22 namespace Konsole 23 { 24 /** 25 * Base class for terminal character decoders 26 * 27 * The decoder converts lines of terminal characters which consist of a unicode character, foreground 28 * and background colors and other appearance-related properties into text strings. 29 * 30 * Derived classes may produce either plain text with no other color or appearance information, or 31 * they may produce text which incorporates these additional properties. 32 */ 33 class KONSOLEDECODERS_EXPORT TerminalCharacterDecoder 34 { 35 public: ~TerminalCharacterDecoder()36 virtual ~TerminalCharacterDecoder() 37 { 38 } 39 40 /** Begin decoding characters. The resulting text is appended to @p output. */ 41 virtual void begin(QTextStream *output) = 0; 42 /** End decoding. */ 43 virtual void end() = 0; 44 45 /** 46 * Converts a line of terminal characters with associated properties into a text string 47 * and writes the string into an output QTextStream. 48 * 49 * @param characters An array of characters of length @p count. 50 * @param count The number of characters 51 * @param properties Additional properties which affect all characters in the line 52 */ 53 virtual void decodeLine(const Character *const characters, int count, LineProperty properties) = 0; 54 }; 55 56 } 57 58 #endif 59