2
This file is part of Konsole, an X terminal.
3
Copyright (C) 2000 by Stephan Kulow <coolo@kde.org>
5
Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2 of the License, or
10
(at your option) any later version.
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
28
//#error Do not use in KDE 2.1
30
#define BlockSize (1 << 12)
31
#define ENTRIES ((BlockSize - sizeof(size_t) ) / sizeof(unsigned char))
39
unsigned char data[ENTRIES];
43
// ///////////////////////////////////////////////////////
49
* Creates a history file for holding
50
* maximal size blocks. If more blocks
51
* are requested, then it drops earlier
60
* adds the Block at the end of history.
61
* This may drop other blocks.
63
* The ownership on the block is transfered.
64
* An unique index number is returned for accessing
65
* it later (if not yet dropped then)
67
* Note, that the block may be dropped completely
68
* if history is turned off.
70
size_t append( Block *block );
73
* gets the block at the index. Function may return
74
* 0 if the block isn't available any more.
76
* The returned block is strictly readonly as only
77
* maped in memory - and will be invalid on the next
78
* operation on this class.
80
const Block *at( size_t index );
83
* reorders blocks as needed. If newsize is null,
84
* the history is emptied completely. The indices
85
* returned on append won't change their semantic,
86
* but they may not be valid after this call.
88
bool setHistorySize( size_t newsize );
92
Block *lastBlock() const;
95
* Convenient function to set the size in KBytes
98
bool setSize( size_t newsize );
100
size_t len() const { return length; }
102
bool has( size_t index ) const;
104
size_t getCurrent() const { return current; }
108
void increaseBuffer();
109
void decreaseBuffer( size_t newsize );
112
// current always shows to the last inserted block
117
size_t lastmap_index;