BFLibCPP 0.1
CPP Library
|
#include <list.hpp>
Classes | |
class | Iterator |
class | Node |
Public Member Functions | |
List () | |
List (const std::initializer_list< L > &list) | |
virtual | ~List () |
S | count () const |
int | add (L obj) |
int | pluckObject (L obj) |
int | deleteObjectAtIndex (S index) |
int | insertObjectAtIndex (L obj, S index) |
void | deleteAll () |
L | objectAtIndex (S index) const |
void | setDeallocateCallback (void(*callback)(L obj)) |
void | setReleaseCallback (void(*callback)(L obj)) |
void | setCompareCallback (int(*callback)(L a, L b)) |
Node * | first () const |
Node * | last () const |
bool | contains (const L obj) |
void | print () |
int | sort () |
int | sort (const ListSortOptions option) |
int | shuffle () |
void | operator= (const std::initializer_list< L > &list) |
Iterator | begin () |
required interfaces: begin() & end() | |
Iterator | end () |
![]() | |
Object () | |
Object (Object &obj) | |
virtual | ~Object () |
Protected Member Functions | |
int | deleteNode (Node *node) |
Additional Inherited Members | |
![]() | |
static void | retain (Object *obj) |
static void | release (Object *obj) |
static int | retainCount (Object *obj) |
static int | retainCount (Object &obj) |
Linked List implementation
Essentially a mutable array
L = object/data type this list will hold onto S = This object has a counter of type S. Default is a 32 bit integer. If you are planning to have a list with size exceeding the 2^32, you should change the S value to 'long' or 'long long'
Memory: Unless a callback is specified, by default the node object memory will not be deallocated.
|
inline |
|
inline |
|
inline |
|
inline |
Checks if there is at least one node with obj
|
inline |
|
inline |
|
inlineprotected |
Delete node but does not delete object
|
inline |
deletes object at the index
index: must not exceed bounds of array
Returns the head of the list
Caller can use this node to traverse through the list
|
inline |
Insert obj at index. Will push every object after an index
index: must be within range of list.
|
inline |
|
inline |
|
inline |
finds object and removes from list
DOES NOT DELETE MEMORY
|
inline |
Prints entire list
|
inline |
Sets the callback we use when sorting
|
inline |
callback will be a pointer to a function that handles how we will delete object memory
|
inline |
sets release callback
|
inline |
Shuffles node links
|
inline |
Default sort kListSortOptionsDefault
|
inline |