OpenCurves
0.9
|
An array of string pointers (into another array) using the given character type. More...
#include <stringitems.h>
Public Member Functions | |
StringItems () | |
Constructor. | |
~StringItems () | |
Destructor. | |
size_t | size () const |
Return the number of items in the array. More... | |
size_t | count () const |
Return the number of items in the array. More... | |
size_t | capacity () const |
Return the current capacity of the array. More... | |
const CHAR * | operator[] (size_t index) const |
Array accessor. More... | |
const CHAR * | operator[] (int index) const |
const CHAR * | operator[] (int64_t index) const |
void | reset () |
Resets the number of items to zero, leaving the capacity unchanged. | |
void | resize (size_t size) |
Resizes such that the count matches size . More... | |
void | reserve (size_t capacity) |
Ensures that the capacity is at least equal to capacity . More... | |
void | push_back (const CHAR *item) |
Adds an item to the array, incrementing the count and adjusting the capacity if required. More... | |
An array of string pointers (into another array) using the given character type.
Used in place of QVector because the latter deallocates on resize to zero. We want to reuse the memory.
CHAR | The character type. Generally char or wchar_t . |
|
inline |
Return the current capacity of the array.
|
inline |
Return the number of items in the array.
|
inline |
Array accessor.
Returns the item at index
.
index | The requested item index, in the range [0, count() ). Out of range requests result in undefined behaviour. |
index
.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void StringItems< CHAR >::push_back | ( | const CHAR * | item | ) |
Adds an item to the array, incrementing the count and adjusting the capacity if required.
item | The string to insert. |
void StringItems< CHAR >::reserve | ( | size_t | capacity | ) |
Ensures that the capacity is at least equal to capacity
.
The capacity does not change if capacity
is less than or equal to the current capaccity.
capacity | The requested capacity. |
void StringItems< CHAR >::resize | ( | size_t | size | ) |
Resizes such that the count matches size
.
The capacity is adjusted up if required, but not down.
size | The requested size. |
|
inline |
Return the number of items in the array.