Debian Codegraph @

lib/History.h

raw symbols SCIP
1 /*
2 This file is part of Konsole, an X terminal.
3 Copyright 1997,1998 by Lars Doelle <[email protected]>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 02110-1301 USA.
19 */
20
21 #ifndef TEHISTORY_H
22 #define TEHISTORY_Hcxx . . $ `lib/History.h:22:9`!
23
24 // Qt
25 #include <QBitRef>
26 #include <QHash>
27 #include <QVector>
28 #include <QTemporaryFile>
29
30 // KDE
31 //#include <ktemporaryfile.h>
32
33 // Konsole
34 #include "BlockArray.h"cxx . . $ `<file>/lib/BlockArray.h`/
35 #include "Character.h"cxx . . $ `<file>/lib/Character.h`/
36
37 // map
38 #include <sys/mman.h>
39
40 namespace Konsolecxx . . $ Konsole/
41 {
42
43 #if 1
44 /*
45 An extendable tmpfile(1) based buffer.
46 */
47
48 class HistoryFilecxx . . $ Konsole/HistoryFile#
49 {
50 public:
51 HistoryFilecxx . . $ Konsole/HistoryFile#HistoryFile(49f6e7a06ebc5aa8).();
52 virtual ~cxx . . $ Konsole/HistoryFile#`~HistoryFile`(ced63f7c635d850d).HistoryFilecxx . . $ Konsole/HistoryFile#();
53
54 virtual void addcxx . . $ Konsole/HistoryFile#add(749a392e780a2e04).(const unsigned char* bytes, int len);
55 virtual void getcxx . . $ Konsole/HistoryFile#get(49a5bbab55ea8abc).(unsigned char* bytes, int len, int loc);
56 virtual int lencxx . . $ Konsole/HistoryFile#len(b126dc7c1de90089).();
57
58 //mmaps the file in read-only mode
59 void mapcxx . . $ Konsole/HistoryFile#map(49f6e7a06ebc5aa8).();
60 //un-mmaps the file
61 void unmapcxx . . $ Konsole/HistoryFile#unmap(49f6e7a06ebc5aa8).();
62 //returns true if the file is mmap'ed
63 bool isMappedcxx . . $ Konsole/HistoryFile#isMapped(50ce9a9e25b4a850).() const;
64
65
66 private:
67 int ioncxx . . $ Konsole/HistoryFile#ion.;
68 int lengthcxx . . $ Konsole/HistoryFile#length.;
69 QTemporaryFilecxx . . $ QTemporaryFile# tmpFilecxx . . $ Konsole/HistoryFile#tmpFile.;
70
71 //pointer to start of mmap'ed file data, or 0 if the file is not mmap'ed
72 char* fileMapcxx . . $ Konsole/HistoryFile#fileMap.;
73
74 //incremented whenver 'add' is called and decremented whenever
75 //'get' is called.
76 //this is used to detect when a large number of lines are being read and processed from the history
77 //and automatically mmap the file for better performance (saves the overhead of many lseek-read calls).
78 int readWriteBalancecxx . . $ Konsole/HistoryFile#readWriteBalance.;
79
80 //when readWriteBalance goes below this threshold, the file will be mmap'ed automatically
81 static const int MAP_THRESHOLDcxx . . $ Konsole/HistoryFile#MAP_THRESHOLD. = -1000;
82 };
83 #endif
84
85 //////////////////////////////////////////////////////////////////////
86
87 //////////////////////////////////////////////////////////////////////
88 // Abstract base class for file and buffer versions
89 //////////////////////////////////////////////////////////////////////
90 class HistoryTypecxx . . $ Konsole/HistoryType#;
91
92 class HistoryScrollcxx . . $ Konsole/HistoryScroll#
93 {
94 public:
95 HistoryScrollcxx . . $ Konsole/HistoryScroll#HistoryScroll(880ad70f7ea64dbe).(HistoryTypecxx . . $ Konsole/HistoryType#*);
96 virtual ~cxx . . $ Konsole/HistoryScroll#`~HistoryScroll`(ced63f7c635d850d).HistoryScrollcxx . . $ Konsole/HistoryScroll#();
97
98 virtual bool hasScrollcxx . . $ Konsole/HistoryScroll#hasScroll(c9857a73d68e59ba).();
99
100 // access to history
101 virtual int getLinescxx . . $ Konsole/HistoryScroll#getLines(b126dc7c1de90089).() = 0;
102 virtual int getLineLencxx . . $ Konsole/HistoryScroll#getLineLen(7864480464b09eea).(int lineno) = 0;
103 virtual void getCellscxx . . $ Konsole/HistoryScroll#getCells(ecb57fcf9e39244).(int lineno, int colno, int count, Charactercxx . . $ Konsole/Character# res[]) = 0;
104 virtual bool isWrappedLinecxx . . $ Konsole/HistoryScroll#isWrappedLine(83c267b20bac841a).(int lineno) = 0;
105
106 // backward compatibility (obsolete)
107 Charactercxx . . $ Konsole/Character# getCellcxx . . $ Konsole/HistoryScroll#getCell(2d30eb1b4b4c5bb3).(int lineno, int colno) { Charactercxx . . $ Konsole/Character# rescxx . . $ Konsole/Character#Character(775c6e5ba34caf00).; getCellscxx . . $ Konsole/HistoryScroll#getCells(ecb57fcf9e39244).(lineno,colno,1,&res); return res; }
108
109 // adding lines.
110 virtual void addCellscxx . . $ Konsole/HistoryScroll#addCells(c93a48d9295084cf).(const Charactercxx . . $ Konsole/Character# a[], int count) = 0;
111 // convenience method - this is virtual so that subclasses can take advantage
112 // of QVector's implicit copying
113 virtual void addCellsVectorcxx . . $ Konsole/HistoryScroll#addCellsVector(76a1241cccfbfdbf).(const QVectorcxx . . $ QVector#<Charactercxx . . $ Konsole/Character#>& cells)
114 {
115 addCellscxx . . $ Konsole/HistoryScroll#addCells(c93a48d9295084cf).(cells.datacxx . . $ QVector#data(1016ee5406d91ab9).(),cells.sizecxx . . $ QVector#size(455f465bc33b4cdf).());
116 }
117
118 virtual void addLinecxx . . $ Konsole/HistoryScroll#addLine(b45ddcbc8423892c).(bool previousWrapped=false) = 0;
119
120 //
121 // FIXME: Passing around constant references to HistoryType instances
122 // is very unsafe, because those references will no longer
123 // be valid if the history scroll is deleted.
124 //
125 const HistoryTypecxx . . $ Konsole/HistoryType#& getTypecxx . . $ Konsole/HistoryScroll#getType(15b6dc00bdc9f90b).() { return *m_histTypecxx . . $ Konsole/HistoryScroll#m_histType.; }
126
127 protected:
128 HistoryTypecxx . . $ Konsole/HistoryType#* m_histTypecxx . . $ Konsole/HistoryScroll#m_histType.;
129
130 };
131
132 #if 1
133
134 //////////////////////////////////////////////////////////////////////
135 // File-based history (e.g. file log, no limitation in length)
136 //////////////////////////////////////////////////////////////////////
137
138 class HistoryScrollFilecxx . . $ Konsole/HistoryScrollFile# : public HistoryScrollcxx . . $ Konsole/HistoryScroll#
139 {
140 public:
141 HistoryScrollFilecxx . . $ Konsole/HistoryScrollFile#HistoryScrollFile(3520e46b33348bf6).(const QStringcxx . . $ QString# &logFileName);
142 ~cxx . . $ Konsole/HistoryScrollFile#`~HistoryScrollFile`(ced63f7c635d850d).HistoryScrollFilecxx . . $ Konsole/HistoryScrollFile#() override;
143
144 int getLinescxx . . $ Konsole/HistoryScrollFile#getLines(b126dc7c1de90089).() override;
145 int getLineLencxx . . $ Konsole/HistoryScrollFile#getLineLen(7864480464b09eea).(int lineno) override;
146 void getCellscxx . . $ Konsole/HistoryScrollFile#getCells(ecb57fcf9e39244).(int lineno, int colno, int count, Charactercxx . . $ Konsole/Character# res[]) override;
147 bool isWrappedLinecxx . . $ Konsole/HistoryScrollFile#isWrappedLine(83c267b20bac841a).(int lineno) override;
148
149 void addCellscxx . . $ Konsole/HistoryScrollFile#addCells(c93a48d9295084cf).(const Charactercxx . . $ Konsole/Character# a[], int count) override;
150 void addLinecxx . . $ Konsole/HistoryScrollFile#addLine(b45ddcbc8423892c).(bool previousWrapped=false) override;
151
152 private:
153 int startOfLinecxx . . $ Konsole/HistoryScrollFile#startOfLine(7864480464b09eea).(int lineno);
154
155 QStringcxx . . $ QString# m_logFileNamecxx . . $ Konsole/HistoryScrollFile#m_logFileName.;
156 HistoryFilecxx . . $ Konsole/HistoryFile# indexcxx . . $ Konsole/HistoryScrollFile#index.; // lines Row(int)
157 HistoryFilecxx . . $ Konsole/HistoryFile# cellscxx . . $ Konsole/HistoryScrollFile#cells.; // text Row(Character)
158 HistoryFilecxx . . $ Konsole/HistoryFile# lineflagscxx . . $ Konsole/HistoryScrollFile#lineflags.; // flags Row(unsigned char)
159 };
160
161
162 //////////////////////////////////////////////////////////////////////
163 // Buffer-based history (limited to a fixed nb of lines)
164 //////////////////////////////////////////////////////////////////////
165 class HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer# : public HistoryScrollcxx . . $ Konsole/HistoryScroll#
166 {
167 public:
168 typedef QVectorcxx . . $ QVector#<Charactercxx . . $ Konsole/Character#> HistoryLinecxx . . $ Konsole/HistoryScrollBuffer#HistoryLine#;
169
170 HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#HistoryScrollBuffer(cb2f890c2fdad230).(unsigned int maxNbLines = 1000);
171 ~cxx . . $ Konsole/HistoryScrollBuffer#`~HistoryScrollBuffer`(ced63f7c635d850d).HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#() override;
172
173 int getLinescxx . . $ Konsole/HistoryScrollBuffer#getLines(b126dc7c1de90089).() override;
174 int getLineLencxx . . $ Konsole/HistoryScrollBuffer#getLineLen(7864480464b09eea).(int lineno) override;
175 void getCellscxx . . $ Konsole/HistoryScrollBuffer#getCells(ecb57fcf9e39244).(int lineno, int colno, int count, Charactercxx . . $ Konsole/Character# res[]) override;
176 bool isWrappedLinecxx . . $ Konsole/HistoryScrollBuffer#isWrappedLine(83c267b20bac841a).(int lineno) override;
177
178 void addCellscxx . . $ Konsole/HistoryScrollBuffer#addCells(c93a48d9295084cf).(const Charactercxx . . $ Konsole/Character# a[], int count) override;
179 void addCellsVectorcxx . . $ Konsole/HistoryScrollBuffer#addCellsVector(76a1241cccfbfdbf).(const QVectorcxx . . $ QVector#<Charactercxx . . $ Konsole/Character#>& cells) override;
180 void addLinecxx . . $ Konsole/HistoryScrollBuffer#addLine(b45ddcbc8423892c).(bool previousWrapped=false) override;
181
182 void setMaxNbLinescxx . . $ Konsole/HistoryScrollBuffer#setMaxNbLines(cb2f890c2fdad230).(unsigned int nbLines);
183 unsigned int maxNbLinescxx . . $ Konsole/HistoryScrollBuffer#maxNbLines(ddd8539a2fcdd4ce).() const { return _maxLineCountcxx . . $ Konsole/HistoryScrollBuffer#_maxLineCount.; }
184
185
186 private:
187 int bufferIndexcxx . . $ Konsole/HistoryScrollBuffer#bufferIndex(7ccb52b1bfe01045).(int lineNumber) const;
188
189 HistoryLinecxx . . $ Konsole/HistoryScrollBuffer#HistoryLine#* _historyBuffercxx . . $ Konsole/HistoryScrollBuffer#_historyBuffer.;
190 QBitArraycxx . . $ QBitArray# _wrappedLinecxx . . $ Konsole/HistoryScrollBuffer#_wrappedLine.;
191 int _maxLineCountcxx . . $ Konsole/HistoryScrollBuffer#_maxLineCount.;
192 int _usedLinescxx . . $ Konsole/HistoryScrollBuffer#_usedLines.;
193 int _headcxx . . $ Konsole/HistoryScrollBuffer#_head.;
194
195 //QVector<histline*> m_histBuffer;
196 //QBitArray m_wrappedLine;
197 //unsigned int m_maxNbLines;
198 //unsigned int m_nbLines;
199 //unsigned int m_arrayIndex;
200 //bool m_buffFilled;
201 };
202
203 /*class HistoryScrollBufferV2 : public HistoryScroll
204 {
205 public:
206 virtual int getLines();
207 virtual int getLineLen(int lineno);
208 virtual void getCells(int lineno, int colno, int count, Character res[]);
209 virtual bool isWrappedLine(int lineno);
210
211 virtual void addCells(const Character a[], int count);
212 virtual void addCells(const QVector<Character>& cells);
213 virtual void addLine(bool previousWrapped=false);
214
215 };*/
216
217 #endif
218
219 //////////////////////////////////////////////////////////////////////
220 // Nothing-based history (no history :-)
221 //////////////////////////////////////////////////////////////////////
222 class HistoryScrollNonecxx . . $ Konsole/HistoryScrollNone# : public HistoryScrollcxx . . $ Konsole/HistoryScroll#
223 {
224 public:
225 HistoryScrollNonecxx . . $ Konsole/HistoryScrollNone#HistoryScrollNone(49f6e7a06ebc5aa8).();
226 ~cxx . . $ Konsole/HistoryScrollNone#`~HistoryScrollNone`(ced63f7c635d850d).HistoryScrollNonecxx . . $ Konsole/HistoryScrollNone#() override;
227
228 bool hasScrollcxx . . $ Konsole/HistoryScrollNone#hasScroll(c9857a73d68e59ba).() override;
229
230 int getLinescxx . . $ Konsole/HistoryScrollNone#getLines(b126dc7c1de90089).() override;
231 int getLineLencxx . . $ Konsole/HistoryScrollNone#getLineLen(7864480464b09eea).(int lineno) override;
232 void getCellscxx . . $ Konsole/HistoryScrollNone#getCells(ecb57fcf9e39244).(int lineno, int colno, int count, Charactercxx . . $ Konsole/Character# res[]) override;
233 bool isWrappedLinecxx . . $ Konsole/HistoryScrollNone#isWrappedLine(83c267b20bac841a).(int lineno) override;
234
235 void addCellscxx . . $ Konsole/HistoryScrollNone#addCells(c93a48d9295084cf).(const Charactercxx . . $ Konsole/Character# a[], int count) override;
236 void addLinecxx . . $ Konsole/HistoryScrollNone#addLine(b45ddcbc8423892c).(bool previousWrapped=false) override;
237 };
238
239 //////////////////////////////////////////////////////////////////////
240 // BlockArray-based history
241 //////////////////////////////////////////////////////////////////////
242 class HistoryScrollBlockArraycxx . . $ Konsole/HistoryScrollBlockArray# : public HistoryScrollcxx . . $ Konsole/HistoryScroll#
243 {
244 public:
245 HistoryScrollBlockArraycxx . . $ Konsole/HistoryScrollBlockArray#HistoryScrollBlockArray(2c44cd906ae4e829).(size_t size);
246 ~cxx . . $ Konsole/HistoryScrollBlockArray#`~HistoryScrollBlockArray`(ced63f7c635d850d).HistoryScrollBlockArraycxx . . $ Konsole/HistoryScrollBlockArray#() override;
247
248 int getLinescxx . . $ Konsole/HistoryScrollBlockArray#getLines(b126dc7c1de90089).() override;
249 int getLineLencxx . . $ Konsole/HistoryScrollBlockArray#getLineLen(7864480464b09eea).(int lineno) override;
250 void getCellscxx . . $ Konsole/HistoryScrollBlockArray#getCells(ecb57fcf9e39244).(int lineno, int colno, int count, Charactercxx . . $ Konsole/Character# res[]) override;
251 bool isWrappedLinecxx . . $ Konsole/HistoryScrollBlockArray#isWrappedLine(83c267b20bac841a).(int lineno) override;
252
253 void addCellscxx . . $ Konsole/HistoryScrollBlockArray#addCells(c93a48d9295084cf).(const Charactercxx . . $ Konsole/Character# a[], int count) override;
254 void addLinecxx . . $ Konsole/HistoryScrollBlockArray#addLine(b45ddcbc8423892c).(bool previousWrapped=false) override;
255
256 protected:
257 BlockArraycxx . . $ Konsole/BlockArray# m_blockArraycxx . . $ Konsole/HistoryScrollBlockArray#m_blockArray.;
258 QHashcxx . . $ QHash#<int,size_t> m_lineLengthscxx . . $ Konsole/HistoryScrollBlockArray#m_lineLengths.;
259 };
260
261 //////////////////////////////////////////////////////////////////////
262 // History using compact storage
263 // This implementation uses a list of fixed-sized blocks
264 // where history lines are allocated in (avoids heap fragmentation)
265 //////////////////////////////////////////////////////////////////////
266 typedef QVectorcxx . . $ QVector#<Charactercxx . . $ Konsole/Character#> TextLinecxx . . $ Konsole/TextLine#;
267
268 class CharacterFormatcxx . . $ Konsole/CharacterFormat#
269 {
270 public:
271 bool equalsFormatcxx . . $ Konsole/CharacterFormat#equalsFormat(df468a6063ab3671).(const CharacterFormatcxx . . $ Konsole/CharacterFormat# &other) const {
272 return other.renditioncxx . . $ Konsole/CharacterFormat#rendition.==renditioncxx . . $ Konsole/CharacterFormat#rendition. && other.fgColorcxx . . $ Konsole/CharacterFormat#fgColor.==cxx . . $ Konsole/`operator==`(40f11079b1efd097).fgColorcxx . . $ Konsole/CharacterFormat#fgColor. && other.bgColorcxx . . $ Konsole/CharacterFormat#bgColor.==cxx . . $ Konsole/`operator==`(40f11079b1efd097).bgColorcxx . . $ Konsole/CharacterFormat#bgColor.;
273 }
274
275 bool equalsFormatcxx . . $ Konsole/CharacterFormat#equalsFormat(3a60cc5fc593e4b3).(const Charactercxx . . $ Konsole/Character# &c) const {
276 return c.renditioncxx . . $ Konsole/Character#rendition.==renditioncxx . . $ Konsole/CharacterFormat#rendition. && c.foregroundColorcxx . . $ Konsole/Character#foregroundColor.==cxx . . $ Konsole/`operator==`(40f11079b1efd097).fgColorcxx . . $ Konsole/CharacterFormat#fgColor. && c.backgroundColorcxx . . $ Konsole/Character#backgroundColor.==cxx . . $ Konsole/`operator==`(40f11079b1efd097).bgColorcxx . . $ Konsole/CharacterFormat#bgColor.;
277 }
278
279 void setFormatcxx . . $ Konsole/CharacterFormat#setFormat(918d3bd737932f15).(const Charactercxx . . $ Konsole/Character#& c) {
280 renditioncxx . . $ Konsole/CharacterFormat#rendition.=c.renditioncxx . . $ Konsole/Character#rendition.;
281 fgColorcxx . . $ Konsole/CharacterFormat#fgColor.=cxx . . $ Konsole/CharacterColor#`operator=`(d3b4b4caeab41583).c.foregroundColorcxx . . $ Konsole/Character#foregroundColor.;
282 bgColorcxx . . $ Konsole/CharacterFormat#bgColor.=cxx . . $ Konsole/CharacterColor#`operator=`(d3b4b4caeab41583).c.backgroundColorcxx . . $ Konsole/Character#backgroundColor.;
283 }
284
285 CharacterColorcxx . . $ Konsole/CharacterColor# fgColorcxx . . $ Konsole/CharacterFormat#fgColor., bgColorcxx . . $ Konsole/CharacterFormat#bgColor.;
286 quint16cxx . . $ quint16# startPoscxx . . $ Konsole/CharacterFormat#startPos.;
287 quint8cxx . . $ quint8# renditioncxx . . $ Konsole/CharacterFormat#rendition.;
288 };
289
290 class CompactHistoryBlockcxx . . $ Konsole/CompactHistoryBlock#
291 {
292 public:
293
294 CompactHistoryBlockcxx . . $ Konsole/CompactHistoryBlock#CompactHistoryBlock(49f6e7a06ebc5aa8).(){
295 blockLengthcxx . . $ Konsole/CompactHistoryBlock#blockLength. = 4096*64; // 256kb
296 headcxx . . $ Konsole/CompactHistoryBlock#head. = (quint8cxx . . $ quint8#*) mmap(nullptr, blockLengthcxx . . $ Konsole/CompactHistoryBlock#blockLength., PROT_READcxx . . $ `<external>/17226767460805440860/mman-linux.h:32:9`!|PROT_WRITEcxx . . $ `<external>/17226767460805440860/mman-linux.h:33:9`!, MAP_PRIVATEcxx . . $ `<external>/17226767460805440860/mman-linux.h:43:9`!|MAP_ANONcxx . . $ `<external>/17226767460805440860/mman-linux.h:57:9`!, -1, 0);
297 //head = (quint8*) malloc(blockLength);
298 Q_ASSERTcxx . . $ Konsole/CompactHistoryBlock#head.(head != MAP_FAILEDcxx . . $ `<external>/6724834311684550606/mman.h:44:9`!);
299 tailcxx . . $ Konsole/CompactHistoryBlock#tail. = blockStartcxx . . $ Konsole/CompactHistoryBlock#blockStart. = headcxx . . $ Konsole/CompactHistoryBlock#head.;
300 allocCountcxx . . $ Konsole/CompactHistoryBlock#allocCount.=0;
301 }
302
303 virtual ~cxx . . $ Konsole/CompactHistoryBlock#`~CompactHistoryBlock`(ced63f7c635d850d).CompactHistoryBlockcxx . . $ Konsole/CompactHistoryBlock#(){
304 //free(blockStart);
305 munmap(blockStartcxx . . $ Konsole/CompactHistoryBlock#blockStart., blockLengthcxx . . $ Konsole/CompactHistoryBlock#blockLength.);
306 }
307
308 virtual unsigned int remainingcxx . . $ Konsole/CompactHistoryBlock#remaining(db52760e79bf9054).(){ return blockStartcxx . . $ Konsole/CompactHistoryBlock#blockStart.+blockLengthcxx . . $ Konsole/CompactHistoryBlock#blockLength.-tailcxx . . $ Konsole/CompactHistoryBlock#tail.;}
309 virtual unsigned lengthcxx . . $ Konsole/CompactHistoryBlock#length(db52760e79bf9054).() { return blockLengthcxx . . $ Konsole/CompactHistoryBlock#blockLength.; }
310 virtual void* allocatecxx . . $ Konsole/CompactHistoryBlock#allocate(bfcfa4d6b7f7ef64).(size_t length);
311 virtual bool containscxx . . $ Konsole/CompactHistoryBlock#contains(db00c6a08f501612).(void *addr) {return addr>=blockStartcxx . . $ Konsole/CompactHistoryBlock#blockStart. && addr<(blockStartcxx . . $ Konsole/CompactHistoryBlock#blockStart.+blockLengthcxx . . $ Konsole/CompactHistoryBlock#blockLength.);}
312 virtual void deallocatecxx . . $ Konsole/CompactHistoryBlock#deallocate(49f6e7a06ebc5aa8).();
313 virtual bool isInUsecxx . . $ Konsole/CompactHistoryBlock#isInUse(c9857a73d68e59ba).(){ return allocCountcxx . . $ Konsole/CompactHistoryBlock#allocCount.!=0; } ;
314
315 private:
316 size_t blockLengthcxx . . $ Konsole/CompactHistoryBlock#blockLength.;
317 quint8cxx . . $ quint8#* headcxx . . $ Konsole/CompactHistoryBlock#head.;
318 quint8cxx . . $ quint8#* tailcxx . . $ Konsole/CompactHistoryBlock#tail.;
319 quint8cxx . . $ quint8#* blockStartcxx . . $ Konsole/CompactHistoryBlock#blockStart.;
320 int allocCountcxx . . $ Konsole/CompactHistoryBlock#allocCount.;
321 };
322
323 class CompactHistoryBlockListcxx . . $ Konsole/CompactHistoryBlockList# {
324 public:
325 CompactHistoryBlockListcxx . . $ Konsole/CompactHistoryBlockList#CompactHistoryBlockList(49f6e7a06ebc5aa8).() {};
326 ~cxx . . $ Konsole/CompactHistoryBlockList#`~CompactHistoryBlockList`(ced63f7c635d850d).CompactHistoryBlockListcxx . . $ Konsole/CompactHistoryBlockList#();
327
328 void *allocatecxx . . $ Konsole/CompactHistoryBlockList#allocate(bfcfa4d6b7f7ef64).( size_t size );
329 void deallocatecxx . . $ Konsole/CompactHistoryBlockList#deallocate(5d22bdacc48458e8).(void *);
330 int lengthcxx . . $ Konsole/CompactHistoryBlockList#length(b126dc7c1de90089).() {return listcxx . . $ Konsole/CompactHistoryBlockList#list..sizecxx . . $ QList#size(ea6fe5115c70a13f).();}
331 private:
332 QListcxx . . $ QList#<CompactHistoryBlockcxx . . $ Konsole/CompactHistoryBlock#*> listcxx . . $ Konsole/CompactHistoryBlockList#list.;
333 };
334
335 class CompactHistoryLinecxx . . $ Konsole/CompactHistoryLine#
336 {
337 public:
338 CompactHistoryLinecxx . . $ Konsole/CompactHistoryLine#CompactHistoryLine(3a09ffb36558665).(const TextLinecxx . . $ Konsole/TextLine#&, CompactHistoryBlockListcxx . . $ Konsole/CompactHistoryBlockList#& blockList);
339 virtual ~cxx . . $ Konsole/CompactHistoryLine#`~CompactHistoryLine`(49f6e7a06ebc5aa8).CompactHistoryLinecxx . . $ Konsole/CompactHistoryLine#();
340
341 // custom new operator to allocate memory from custom pool instead of heap
342 static void *operatorcxx . . $ Konsole/CompactHistoryLine#`operator new`(c29bf00dce6c1e9e). new( size_t size, CompactHistoryBlockListcxx . . $ Konsole/CompactHistoryBlockList#& blockList);
343 static void operatorcxx . . $ Konsole/CompactHistoryLine#`operator delete`(bd21765a0afc8e3c). delete( void *) { /* do nothing, deallocation from pool is done in destructor*/ } ;
344
345 virtual void getCharacterscxx . . $ Konsole/CompactHistoryLine#getCharacters(9044b40aa8f691ab).(Charactercxx . . $ Konsole/Character#* array, int length, int startColumn) ;
346 virtual void getCharactercxx . . $ Konsole/CompactHistoryLine#getCharacter(d98d5e3bf4790af1).(int index, Charactercxx . . $ Konsole/Character# &r) ;
347 virtual bool isWrappedcxx . . $ Konsole/CompactHistoryLine#isWrapped(50ce9a9e25b4a850).() const {return wrappedcxx . . $ Konsole/CompactHistoryLine#wrapped.;};
348 virtual void setWrappedcxx . . $ Konsole/CompactHistoryLine#setWrapped(b45ddcbc8423892c).(bool isWrapped) { wrappedcxx . . $ Konsole/CompactHistoryLine#wrapped.=isWrapped;};
349 virtual unsigned int getLengthcxx . . $ Konsole/CompactHistoryLine#getLength(ddd8539a2fcdd4ce).() const {return lengthcxx . . $ Konsole/CompactHistoryLine#length.;};
350
351 protected:
352 CompactHistoryBlockListcxx . . $ Konsole/CompactHistoryBlockList#& blockListcxx . . $ Konsole/CompactHistoryLine#blockList.;
353 CharacterFormatcxx . . $ Konsole/CharacterFormat#* formatArraycxx . . $ Konsole/CompactHistoryLine#formatArray.;
354 quint16cxx . . $ quint16# lengthcxx . . $ Konsole/CompactHistoryLine#length.;
355 quint16cxx . . $ quint16#* textcxx . . $ Konsole/CompactHistoryLine#text.;
356 quint16cxx . . $ quint16# formatLengthcxx . . $ Konsole/CompactHistoryLine#formatLength.;
357 bool wrappedcxx . . $ Konsole/CompactHistoryLine#wrapped.;
358 };
359
360 class CompactHistoryScrollcxx . . $ Konsole/CompactHistoryScroll# : public HistoryScrollcxx . . $ Konsole/HistoryScroll#
361 {
362 typedef QListcxx . . $ QList#<CompactHistoryLinecxx . . $ Konsole/CompactHistoryLine#*> HistoryArraycxx . . $ Konsole/CompactHistoryScroll#HistoryArray#;
363
364 public:
365 CompactHistoryScrollcxx . . $ Konsole/CompactHistoryScroll#CompactHistoryScroll(cb2f890c2fdad230).(unsigned int maxNbLines = 1000);
366 ~cxx . . $ Konsole/CompactHistoryScroll#`~CompactHistoryScroll`(ced63f7c635d850d).CompactHistoryScrollcxx . . $ Konsole/CompactHistoryScroll#() override;
367
368 int getLinescxx . . $ Konsole/CompactHistoryScroll#getLines(b126dc7c1de90089).() override;
369 int getLineLencxx . . $ Konsole/CompactHistoryScroll#getLineLen(7864480464b09eea).(int lineno) override;
370 void getCellscxx . . $ Konsole/CompactHistoryScroll#getCells(ecb57fcf9e39244).(int lineno, int colno, int count, Charactercxx . . $ Konsole/Character# res[]) override;
371 bool isWrappedLinecxx . . $ Konsole/CompactHistoryScroll#isWrappedLine(83c267b20bac841a).(int lineno) override;
372
373 void addCellscxx . . $ Konsole/CompactHistoryScroll#addCells(c93a48d9295084cf).(const Charactercxx . . $ Konsole/Character# a[], int count) override;
374 void addCellsVectorcxx . . $ Konsole/CompactHistoryScroll#addCellsVector(76a1241cccfbfdbf).(const TextLinecxx . . $ Konsole/TextLine#& cells) override;
375 void addLinecxx . . $ Konsole/CompactHistoryScroll#addLine(b45ddcbc8423892c).(bool previousWrapped=false) override;
376
377 void setMaxNbLinescxx . . $ Konsole/CompactHistoryScroll#setMaxNbLines(cb2f890c2fdad230).(unsigned int nbLines);
378 unsigned int maxNbLinescxx . . $ Konsole/CompactHistoryScroll#maxNbLines(ddd8539a2fcdd4ce).() const { return _maxLineCountcxx . . $ Konsole/CompactHistoryScroll#_maxLineCount.; }
379
380 private:
381 bool hasDifferentColorscxx . . $ Konsole/CompactHistoryScroll#hasDifferentColors(bc087b561301c512).(const TextLinecxx . . $ Konsole/TextLine#& line) const;
382 HistoryArraycxx . . $ Konsole/CompactHistoryScroll#HistoryArray# linescxx . . $ Konsole/CompactHistoryScroll#lines.;
383 CompactHistoryBlockListcxx . . $ Konsole/CompactHistoryBlockList# blockListcxx . . $ Konsole/CompactHistoryScroll#blockList.;
384
385 unsigned int _maxLineCountcxx . . $ Konsole/CompactHistoryScroll#_maxLineCount.;
386 };
387
388 //////////////////////////////////////////////////////////////////////
389 // History type
390 //////////////////////////////////////////////////////////////////////
391
392 class HistoryTypecxx . . $ Konsole/HistoryType#
393 {
394 public:
395 HistoryTypecxx . . $ Konsole/HistoryType#HistoryType(49f6e7a06ebc5aa8).();
396 virtual ~cxx . . $ Konsole/HistoryType#`~HistoryType`(ced63f7c635d850d).HistoryTypecxx . . $ Konsole/HistoryType#();
397
398 /**
399 * Returns true if the history is enabled ( can store lines of output )
400 * or false otherwise.
401 */
402 virtual bool isEnabledcxx . . $ Konsole/HistoryType#isEnabled(50ce9a9e25b4a850).() const = 0;
403 /**
404 * Returns true if the history size is unlimited.
405 */
406 bool isUnlimitedcxx . . $ Konsole/HistoryType#isUnlimited(50ce9a9e25b4a850).() const { return maximumLineCountcxx . . $ Konsole/HistoryType#maximumLineCount(455f465bc33b4cdf).() == 0; }
407 /**
408 * Returns the maximum number of lines which this history type
409 * can store or 0 if the history can store an unlimited number of lines.
410 */
411 virtual int maximumLineCountcxx . . $ Konsole/HistoryType#maximumLineCount(455f465bc33b4cdf).() const = 0;
412
413 virtual HistoryScrollcxx . . $ Konsole/HistoryScroll#* scrollcxx . . $ Konsole/HistoryType#scroll(a5ef36c6e2fab2f9).(HistoryScrollcxx . . $ Konsole/HistoryScroll# *) const = 0;
414 };
415
416 class HistoryTypeNonecxx . . $ Konsole/HistoryTypeNone# : public HistoryTypecxx . . $ Konsole/HistoryType#
417 {
418 public:
419 HistoryTypeNonecxx . . $ Konsole/HistoryTypeNone#HistoryTypeNone(49f6e7a06ebc5aa8).();
420
421 bool isEnabledcxx . . $ Konsole/HistoryTypeNone#isEnabled(50ce9a9e25b4a850).() const override;
422 int maximumLineCountcxx . . $ Konsole/HistoryTypeNone#maximumLineCount(455f465bc33b4cdf).() const override;
423
424 HistoryScrollcxx . . $ Konsole/HistoryScroll#* scrollcxx . . $ Konsole/HistoryTypeNone#scroll(a5ef36c6e2fab2f9).(HistoryScrollcxx . . $ Konsole/HistoryScroll# *) const override;
425 };
426
427 class HistoryTypeBlockArraycxx . . $ Konsole/HistoryTypeBlockArray# : public HistoryTypecxx . . $ Konsole/HistoryType#
428 {
429 public:
430 HistoryTypeBlockArraycxx . . $ Konsole/HistoryTypeBlockArray#HistoryTypeBlockArray(2c44cd906ae4e829).(size_t size);
431
432 bool isEnabledcxx . . $ Konsole/HistoryTypeBlockArray#isEnabled(50ce9a9e25b4a850).() const override;
433 int maximumLineCountcxx . . $ Konsole/HistoryTypeBlockArray#maximumLineCount(455f465bc33b4cdf).() const override;
434
435 HistoryScrollcxx . . $ Konsole/HistoryScroll#* scrollcxx . . $ Konsole/HistoryTypeBlockArray#scroll(a5ef36c6e2fab2f9).(HistoryScrollcxx . . $ Konsole/HistoryScroll# *) const override;
436
437 protected:
438 size_t m_sizecxx . . $ Konsole/HistoryTypeBlockArray#m_size.;
439 };
440
441 #if 1
442 class HistoryTypeFilecxx . . $ Konsole/HistoryTypeFile# : public HistoryTypecxx . . $ Konsole/HistoryType#
443 {
444 public:
445 HistoryTypeFilecxx . . $ Konsole/HistoryTypeFile#HistoryTypeFile(3520e46b33348bf6).(const QStringcxx . . $ QString#& fileName=QStringcxx . . $ QString#QString(ced63f7c635d850d).());
446
447 bool isEnabledcxx . . $ Konsole/HistoryTypeFile#isEnabled(50ce9a9e25b4a850).() const override;
448 virtual const QStringcxx . . $ QString#& getFileNamecxx . . $ Konsole/HistoryTypeFile#getFileName(a2fb7a6ce195d51).() const;
449 int maximumLineCountcxx . . $ Konsole/HistoryTypeFile#maximumLineCount(455f465bc33b4cdf).() const override;
450
451 HistoryScrollcxx . . $ Konsole/HistoryScroll#* scrollcxx . . $ Konsole/HistoryTypeFile#scroll(a5ef36c6e2fab2f9).(HistoryScrollcxx . . $ Konsole/HistoryScroll# *) const override;
452
453 protected:
454 QStringcxx . . $ QString# m_fileNamecxx . . $ Konsole/HistoryTypeFile#m_fileName.;
455 };
456
457
458 class HistoryTypeBuffercxx . . $ Konsole/HistoryTypeBuffer# : public HistoryTypecxx . . $ Konsole/HistoryType#
459 {
460 friend class HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#;
461
462 public:
463 HistoryTypeBuffercxx . . $ Konsole/HistoryTypeBuffer#HistoryTypeBuffer(cb2f890c2fdad230).(unsigned int nbLines);
464
465 bool isEnabledcxx . . $ Konsole/HistoryTypeBuffer#isEnabled(50ce9a9e25b4a850).() const override;
466 int maximumLineCountcxx . . $ Konsole/HistoryTypeBuffer#maximumLineCount(455f465bc33b4cdf).() const override;
467
468 HistoryScrollcxx . . $ Konsole/HistoryScroll#* scrollcxx . . $ Konsole/HistoryTypeBuffer#scroll(a5ef36c6e2fab2f9).(HistoryScrollcxx . . $ Konsole/HistoryScroll# *) const override;
469
470 protected:
471 unsigned int m_nbLinescxx . . $ Konsole/HistoryTypeBuffer#m_nbLines.;
472 };
473
474 class CompactHistoryTypecxx . . $ Konsole/CompactHistoryType# : public HistoryTypecxx . . $ Konsole/HistoryType#
475 {
476 public:
477 CompactHistoryTypecxx . . $ Konsole/CompactHistoryType#CompactHistoryType(cb2f890c2fdad230).(unsigned int size);
478
479 bool isEnabledcxx . . $ Konsole/CompactHistoryType#isEnabled(50ce9a9e25b4a850).() const override;
480 int maximumLineCountcxx . . $ Konsole/CompactHistoryType#maximumLineCount(455f465bc33b4cdf).() const override;
481
482 HistoryScrollcxx . . $ Konsole/HistoryScroll#* scrollcxx . . $ Konsole/CompactHistoryType#scroll(a5ef36c6e2fab2f9).(HistoryScrollcxx . . $ Konsole/HistoryScroll# *) const override;
483
484 protected:
485 unsigned int m_nbLinescxx . . $ Konsole/CompactHistoryType#m_nbLines.;
486 };
487
488
489 #endif
490
491 }
492
493 #endif // TEHISTORY_H