edbee - Qt Editor Library
|
This class is used to define a gap vector. A Gapvector is split in 2 parts. where the gap is moved to the insertation/changing point. So reducing the movement of fields. More...
#include <gapvector.h>
Public Member Functions | |
GapVector (int capacity=16) | |
~GapVector () | |
int | length () const |
returns the used length of the data More... | |
int | gapSize () const |
int | gapBegin () const |
int | gapEnd () const |
int | capacity () const |
void | clear () |
clears the data More... | |
void | replace (int offset, int length, const T *data, int newLength) |
this method replaces the given items More... | |
void | fill (int offset, int length, const T &data, int newLength) |
this method replaces the given items with a single data item More... | |
void | append (T t) |
convenient append method More... | |
void | append (const T *t, int length) |
another append method More... | |
T | at (int offset) const |
This method returns the item at the given index. More... | |
void | set (int offset, const T &value) |
This method sets an item at the given index. More... | |
T & | operator[] (int offset) |
This method return an index. More... | |
T & | rawAt (int index) |
This method returns the 'raw' element at the given location This method does NOT take in account the gap. More... | |
void | copyRange (QChar *data, int offset, int length) const |
This method copies the given range to the data pointer. More... | |
T * | data () |
This method returns a direct pointer to the 0-terminated buffer This pointer is only valid as long as the buffer doesn't change WARNING, this method MOVES the gap! Which means this method should NOT be used for a lot of operations. More... | |
void | moveGapTo (int offset) |
void | ensureGapSize (int requiredSize) |
this method makes sure there's enough room for the insertation More... | |
void | resize (int newSize) |
resizes the array of data More... | |
void | setGrowSize (int size) |
sets the growsize. The growsize if the amount to reserve extra More... | |
int | growSize () |
returns the growsize More... | |
QString | getUnitTestString (QChar gapChar='_') const |
Converts the 'gap-buffer' to a unit-test debugging string. More... | |
QString | getUnitTestString2 () const |
Converts the 'gap-buffer' to a unit-test debugging string. More... | |
Protected Member Functions | |
void | replace (int offset, int length, const T *data) |
this method replaces the given text with the given data. because the length of the source and target is the same in this method no gap-moving is required More... | |
void | fill (int offset, int length, const T &data) |
this method replaces the given text with the given data. because the length of the source and target is the same in this method no gap-moving is required More... | |
Protected Attributes | |
T * | items_ |
The item data. More... | |
int | capacity_ |
The number of reserved bytes. More... | |
int | gapBegin_ |
The start of the gap. More... | |
int | gapEnd_ |
The end of the gap. More... | |
int | growSize_ |
The size to grow extra. More... | |
This class is used to define a gap vector. A Gapvector is split in 2 parts. where the gap is moved to the insertation/changing point. So reducing the movement of fields.
|
inline |
|
inline |
|
inline |
convenient append method
|
inline |
another append method
|
inline |
This method returns the item at the given index.
|
inline |
|
inline |
clears the data
|
inline |
This method copies the given range to the data pointer.
|
inline |
This method returns a direct pointer to the 0-terminated buffer This pointer is only valid as long as the buffer doesn't change WARNING, this method MOVES the gap! Which means this method should NOT be used for a lot of operations.
|
inline |
this method makes sure there's enough room for the insertation
|
inlineprotected |
this method replaces the given text with the given data. because the length of the source and target is the same in this method no gap-moving is required
offset | the target to move the data to |
length | the number of items to replace |
data | the data pointer with the source data |
|
inline |
this method replaces the given items with a single data item
offset | the offset of the items to replace |
lenth | the number of items to replace |
newLength | the number of times to repeat data |
|
inline |
|
inline |
|
inline |
|
inline |
Converts the 'gap-buffer' to a unit-test debugging string.
|
inline |
Converts the 'gap-buffer' to a unit-test debugging string.
|
inline |
returns the growsize
|
inline |
returns the used length of the data
|
inline |
|
inline |
This method return an index.
|
inline |
This method returns the 'raw' element at the given location This method does NOT take in account the gap.
|
inlineprotected |
this method replaces the given text with the given data. because the length of the source and target is the same in this method no gap-moving is required
offset | the target to move the data to |
length | the number of items to replace |
data | the data pointer with the source data |
|
inline |
this method replaces the given items
offset | the offset of the items to replace |
lenth | the number of items to replace |
data | an array with new items |
newLength | the number of items in the new array |
|
inline |
resizes the array of data
|
inline |
This method sets an item at the given index.
|
inline |
sets the growsize. The growsize if the amount to reserve extra
|
protected |
The number of reserved bytes.
|
protected |
The start of the gap.
|
protected |
The end of the gap.
|
protected |
The size to grow extra.
|
protected |
The item data.