• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

Konsole

  • kde-4.14
  • applications
  • konsole
  • src
TerminalCharacterDecoder.h
Go to the documentation of this file.
1 /*
2  This file is part of Konsole, an X terminal.
3 
4  Copyright 2006-2008 by Robert Knight <robertknight@gmail.com>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  02110-1301 USA.
20 */
21 
22 #ifndef TERMINAL_CHARACTER_DECODER_H
23 #define TERMINAL_CHARACTER_DECODER_H
24 
25 // Qt
26 #include <QtCore/QList>
27 
28 // Konsole
29 #include "Character.h"
30 #include "konsole_export.h"
31 
32 class QTextStream;
33 
34 namespace Konsole
35 {
45 class KONSOLEPRIVATE_EXPORT TerminalCharacterDecoder
46 {
47 public:
48  virtual ~TerminalCharacterDecoder() {}
49 
51  virtual void begin(QTextStream* output) = 0;
53  virtual void end() = 0;
54 
63  virtual void decodeLine(const Character* const characters,
64  int count,
65  LineProperty properties) = 0;
66 };
67 
72 class KONSOLEPRIVATE_EXPORT PlainTextDecoder : public TerminalCharacterDecoder
73 {
74 public:
75  PlainTextDecoder();
76 
82  void setTrailingWhitespace(bool enable);
87  bool trailingWhitespace() const;
93  QList<int> linePositions() const;
95  void setRecordLinePositions(bool record);
96 
97  virtual void begin(QTextStream* output);
98  virtual void end();
99 
100  virtual void decodeLine(const Character* const characters,
101  int count,
102  LineProperty properties);
103 
104 private:
105  QTextStream* _output;
106  bool _includeTrailingWhitespace;
107 
108  bool _recordLinePositions;
109  QList<int> _linePositions;
110 };
111 
115 class KONSOLEPRIVATE_EXPORT HTMLDecoder : public TerminalCharacterDecoder
116 {
117 public:
121  HTMLDecoder();
122 
127  void setColorTable(const ColorEntry* table);
128 
129  virtual void decodeLine(const Character* const characters,
130  int count,
131  LineProperty properties);
132 
133  virtual void begin(QTextStream* output);
134  virtual void end();
135 
136 private:
137  void openSpan(QString& text , const QString& style);
138  void closeSpan(QString& text);
139 
140  QTextStream* _output;
141  const ColorEntry* _colorTable;
142  bool _innerSpanOpen;
143  quint8 _lastRendition;
144  CharacterColor _lastForeColor;
145  CharacterColor _lastBackColor;
146 };
147 }
148 
149 #endif
Konsole::HTMLDecoder
A terminal character decoder which produces pretty HTML markup.
Definition: TerminalCharacterDecoder.h:115
Konsole::LineProperty
unsigned char LineProperty
Definition: Character.h:31
konsole_export.h
QTextStream
Konsole::PlainTextDecoder
A terminal character decoder which produces plain text, ignoring colors and other appearance-related ...
Definition: TerminalCharacterDecoder.h:72
Konsole::Character
A single character in the terminal which consists of a unicode character value, foreground and backgr...
Definition: Character.h:77
Konsole::TerminalCharacterDecoder
Base class for terminal character decoders.
Definition: TerminalCharacterDecoder.h:45
Konsole::ColorEntry
An entry in a terminal display's color palette.
Definition: CharacterColor.h:40
Konsole::TerminalCharacterDecoder::~TerminalCharacterDecoder
virtual ~TerminalCharacterDecoder()
Definition: TerminalCharacterDecoder.h:48
QString
QList< int >
Character.h
Konsole::CharacterColor
Describes the color of a single character in the terminal.
Definition: CharacterColor.h:147
KONSOLEPRIVATE_EXPORT
#define KONSOLEPRIVATE_EXPORT
Definition: konsole_export.h:33
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Konsole

Skip menu "Konsole"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal