Hasty Badger
Small UI library (a branch of Turbo Badger)
|
TBListOf is a list (array) of pointers to the specified object type. More...
#include <tb_list.h>
Public Member Functions | |
bool | Reserve (int num) |
Make sure there is space for at least num items in the list. More... | |
bool | GrowIfNeeded () |
Make sure there is space for at least one more item in the list. More... | |
bool | Add (T *data) |
Add data at the end of the list. More... | |
bool | Add (T *data, int index) |
Add data at the given index in the list. More... | |
void | Set (T *data, int index) |
Replace the item at the index with the new data. | |
T * | Get (int index) const |
Returns the content at position index. More... | |
T * | operator[] (int index) const |
Returns the content at position index. More... | |
T * | RemoveFast (int index) |
Remove the item at position index from the list and returns the pointer. More... | |
T * | Remove (int index) |
Remove the item at position index from the list and returns the pointer. More... | |
void | DeleteFast (int index) |
Deletes the item at position index after removing it from the list. More... | |
void | Delete (int index) |
Deletes the item at position index after removing it from the list. More... | |
void | RemoveAll () |
Remove all items without deleding them. More... | |
void | DeleteAll () |
Remove and delete all items from the list. More... | |
void | Swap (int index1, int index2) |
Swap the items at index1 and index2. | |
int | Find (T *data) const |
Search for the item with the given data and return the found index, or -1 if not found. More... | |
int | GetNumItems () const |
Get the number of items in the list. More... | |
int | GetCapacity () const |
Get the capacity of the list number of items it can hold without allocating more memory) | |
TBListOf is a list (array) of pointers to the specified object type.
Note: The objects won't be deleted automatically. If you want that, use TBListAutoDeleteOf!
|
inline |
Add data at the end of the list.
Returns false on OOM failure.
|
inline |
Add data at the given index in the list.
Returns false on OOM failure.
|
inline |
Deletes the item at position index after removing it from the list.
|
inline |
Remove and delete all items from the list.
|
inline |
Deletes the item at position index after removing it from the list.
This method should only be used when the order of the list is not important. If the order is important, use Delete()
|
inline |
Search for the item with the given data and return the found index, or -1 if not found.
|
inline |
Returns the content at position index.
|
inline |
Get the number of items in the list.
|
inline |
Make sure there is space for at least one more item in the list.
Returns false on OOM failure. There's no need to call this, but it can make OOM handling easier in some situations since you can guarantee there is space is in a list before you allocate an object to insert into it.
|
inline |
Returns the content at position index.
|
inline |
Remove the item at position index from the list and returns the pointer.
|
inline |
Remove all items without deleding them.
|
inline |
Remove the item at position index from the list and returns the pointer.
This method should only be used when the order of the list is not important. If the order is important, use Remove()
|
inline |
Make sure there is space for at least num items in the list.
Returns false on OOM failure.