File indexing completed on 2024-04-28 05:50:39
0001 /* 0002 SPDX-FileCopyrightText: 2006-2008 Robert Knight <robertknight@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef TERMINAL_CHARACTER_DECODER_H 0008 #define TERMINAL_CHARACTER_DECODER_H 0009 0010 // Qt 0011 #include <QExplicitlySharedDataPointer> 0012 0013 // Konsole characters 0014 #include <Character.h> 0015 0016 class QTextStream; 0017 0018 namespace Konsole 0019 { 0020 /** 0021 * Base class for terminal character decoders 0022 * 0023 * The decoder converts lines of terminal characters which consist of a unicode character, foreground 0024 * and background colors and other appearance-related properties into text strings. 0025 * 0026 * Derived classes may produce either plain text with no other color or appearance information, or 0027 * they may produce text which incorporates these additional properties. 0028 */ 0029 class TerminalCharacterDecoder 0030 { 0031 public: 0032 virtual ~TerminalCharacterDecoder() 0033 { 0034 } 0035 0036 /** Begin decoding characters. The resulting text is appended to @p output. */ 0037 virtual void begin(QTextStream *output) = 0; 0038 /** End decoding. */ 0039 virtual void end() = 0; 0040 0041 /** 0042 * Converts a line of terminal characters with associated properties into a text string 0043 * and writes the string into an output QTextStream. 0044 * 0045 * @param characters An array of characters of length @p count. 0046 * @param count The number of characters 0047 * @param properties Additional properties which affect all characters in the line 0048 */ 0049 virtual void decodeLine(const Character *characters, int count, LineProperty properties) = 0; 0050 }; 0051 0052 } 0053 0054 #endif