Skip to content

Commit 61a1121

Browse files
committed
[GRASS] qtermwidget updated to github.com/qterminal/qtermwidget 72ffc262
1 parent 84a4036 commit 61a1121

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+16332
-14236
lines changed

src/plugins/grass/qtermwidget/BlockArray.cpp

Lines changed: 260 additions & 242 deletions
Large diffs are not rendered by default.

src/plugins/grass/qtermwidget/BlockArray.h

Lines changed: 88 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -30,97 +30,100 @@
3030
#define BlockSize (1 << 12)
3131
#define ENTRIES ((BlockSize - sizeof(size_t) ) / sizeof(unsigned char))
3232

33-
namespace Konsole
34-
{
33+
namespace Konsole {
3534

36-
struct Block
37-
{
38-
Block() { size = 0; }
35+
struct Block {
36+
Block() {
37+
size = 0;
38+
}
3939
unsigned char data[ENTRIES];
4040
size_t size;
41-
};
41+
};
4242

4343
// ///////////////////////////////////////////////////////
4444

45-
class BlockArray
46-
{
47-
public:
48-
/**
49-
* Creates a history file for holding
50-
* maximal size blocks. If more blocks
51-
* are requested, then it drops earlier
52-
* added ones.
53-
*/
54-
BlockArray();
55-
56-
/// destructor
57-
~BlockArray();
58-
59-
/**
60-
* adds the Block at the end of history.
61-
* This may drop other blocks.
62-
*
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)
66-
*
67-
* Note, that the block may be dropped completely
68-
* if history is turned off.
69-
*/
70-
size_t append( Block *block );
71-
72-
/**
73-
* gets the block at the index. Function may return
74-
* 0 if the block isn't available any more.
75-
*
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.
79-
*/
80-
const Block *at( size_t index );
81-
82-
/**
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.
87-
*/
88-
bool setHistorySize( size_t newsize );
89-
90-
size_t newBlock();
91-
92-
Block *lastBlock() const;
93-
94-
/**
95-
* Convenient function to set the size in KBytes
96-
* instead of blocks
97-
*/
98-
bool setSize( size_t newsize );
99-
100-
size_t len() const { return length; }
101-
102-
bool has( size_t index ) const;
103-
104-
size_t getCurrent() const { return current; }
105-
106-
private:
107-
void unmap();
108-
void increaseBuffer();
109-
void decreaseBuffer( size_t newsize );
110-
111-
size_t size;
112-
// current always shows to the last inserted block
113-
size_t current;
114-
size_t index;
115-
116-
Block *lastmap;
117-
size_t lastmap_index;
118-
Block *lastblock;
119-
120-
int ion;
121-
size_t length;
122-
123-
};
45+
class BlockArray {
46+
public:
47+
/**
48+
* Creates a history file for holding
49+
* maximal size blocks. If more blocks
50+
* are requested, then it drops earlier
51+
* added ones.
52+
*/
53+
BlockArray();
54+
55+
/// destructor
56+
~BlockArray();
57+
58+
/**
59+
* adds the Block at the end of history.
60+
* This may drop other blocks.
61+
*
62+
* The ownership on the block is transfered.
63+
* An unique index number is returned for accessing
64+
* it later (if not yet dropped then)
65+
*
66+
* Note, that the block may be dropped completely
67+
* if history is turned off.
68+
*/
69+
size_t append(Block * block);
70+
71+
/**
72+
* gets the block at the index. Function may return
73+
* 0 if the block isn't available any more.
74+
*
75+
* The returned block is strictly readonly as only
76+
* maped in memory - and will be invalid on the next
77+
* operation on this class.
78+
*/
79+
const Block * at(size_t index);
80+
81+
/**
82+
* reorders blocks as needed. If newsize is null,
83+
* the history is emptied completely. The indices
84+
* returned on append won't change their semantic,
85+
* but they may not be valid after this call.
86+
*/
87+
bool setHistorySize(size_t newsize);
88+
89+
size_t newBlock();
90+
91+
Block * lastBlock() const;
92+
93+
/**
94+
* Convenient function to set the size in KBytes
95+
* instead of blocks
96+
*/
97+
bool setSize(size_t newsize);
98+
99+
size_t len() const {
100+
return length;
101+
}
102+
103+
bool has(size_t index) const;
104+
105+
size_t getCurrent() const {
106+
return current;
107+
}
108+
109+
private:
110+
void unmap();
111+
void increaseBuffer();
112+
void decreaseBuffer(size_t newsize);
113+
114+
size_t size;
115+
// current always shows to the last inserted block
116+
size_t current;
117+
size_t index;
118+
119+
Block * lastmap;
120+
size_t lastmap_index;
121+
Block * lastblock;
122+
123+
int ion;
124+
size_t length;
125+
126+
};
124127

125128
}
126129

0 commit comments

Comments
 (0)