|
GL Studio C++ Runtime API
|
#include <list.h>
Public Member Functions | |
| int | IsEmpty () |
| void | Empty () |
| ListItem * | First () |
| ListItem * | Last () |
| ListItem * | Nth (int where) |
| void | InsertAfter (int where, const void *data, int size, void **parentPtr) |
| void | InsertAfter (ListItem *after, const void *data, int size, void **parentPtr) |
| void | InsertAfter (ListItem *after, ListItem *pNewNode) |
| void | InsertBefore (ListItem *before, ListItem *pNewNode) |
| void | Push (const void *data, int size, void **parentPtr) |
| void | Push (const void *data, int size) |
| void | Push (ListItem *pNewNode) |
| void | Enqueue (const void *data, int size, void **parentPtr) |
| void | Enqueue (const void *data, int size) |
| void | Enqueue (ListItem *pNewNode) |
| void * | Dequeue () |
| void * | GetElement (int where) |
| int | Count () |
| void | Delete (ListItem *element) |
| void | AddNodeWithPriority (ListItem *pNewNode, int priority) |
| void | AddNodeWithPriority (const void *data, int size, int priority) |
| void | ForwardIterator (ListIterator func, void *data=NULL) |
| void | BackwardIterator (ListIterator func, void *data=NULL) |
| void | Iterator (ListIterator func, void *data, ListIteratorDirection direction) |
Public Attributes | |
| int | _count |
| Number of items in the list. | |
Protected Attributes | |
| ListItem * | _pHead |
| Pointer to the head (first item) of the list. | |
| ListItem * | _pTail |
| Pointer to the tail (last item) of the list. | |
Implements a doubly Linked List
| void AddNodeWithPriority | ( | const void * | data, |
| int | size, | ||
| int | priority | ||
| ) |
Adds a new node (item) to the list. The item position will be determined based on its priority. This method will dynamically allocate space for the data
| data | Pointer to the data to be added |
| size | Size of the data to be added |
| priority | Sorting priority |
| void AddNodeWithPriority | ( | ListItem * | pNewNode, |
| int | priority | ||
| ) |
Adds a new node (item) to the list. The item position will be determined based on its priority.
| pNewNode | A previously allocated list node containing the data to add |
| priority | Sorting priority |
| void BackwardIterator | ( | ListIterator | func, |
| void * | data = NULL |
||
| ) |
Iterates through the list in reverse order, calling the supplied function on each element and passing the supplied data to that function
| func | ListIterator function to call |
| data | Data that will be supplied to each call of the list iterator function |
| int Count | ( | ) |
| void Delete | ( | ListItem * | element | ) |
Deletes the specified list element. Frees the data pointed to by the element.
| element | The element to delete |
| void * Dequeue | ( | ) |
Gets a pointer to the data in the first element of the list. The list element will be freed. The user should free the data returned by this call.
| void Empty | ( | ) |
Empties the list (deletes all the elements)
| void Enqueue | ( | const void * | data, |
| int | size | ||
| ) |
Inserts the given data at the end of the list. A new ListItem will be allocated, space will be allocated for the data passed in
| data | Pointer to the data to insert |
| size | Size of the data to insert |
| void Enqueue | ( | const void * | data, |
| int | size, | ||
| void ** | parentPtr | ||
| ) |
| void Enqueue | ( | ListItem * | pNewNode | ) |
Inserts the given list element at the end of the list
| pNewNode | A previously allocated ListItem to insert |
| ListItem * First | ( | ) |
| void ForwardIterator | ( | ListIterator | func, |
| void * | data = NULL |
||
| ) |
Iterates through the list from head to tail, calling the supplied function on each element and passing the supplied data to that function
| func | ListIterator function to call |
| data | Data that will be supplied to each call of the list iterator function |
| void * GetElement | ( | int | where | ) |
Gets a pointer to the data at the given "index" into the list.
| where | The index into the list. |
| void InsertAfter | ( | int | where, |
| const void * | data, | ||
| int | size, | ||
| void ** | parentPtr | ||
| ) |
Inserts the given data at designated index in the list. If the index is greater than the list size, the element will be inserted at the end of the list A new ListItem will be allocated, space will be allocated for the data passed in
| where | The zero based index |
| data | Pointer to the data to insert |
| size | Size of the data to insert |
| parentPtr | Will be filled in with a pointer to the ListItem that this method allocates |
| void InsertAfter | ( | ListItem * | after, |
| const void * | data, | ||
| int | size, | ||
| void ** | parentPtr | ||
| ) |
Inserts the given data after the specified list item A new ListItem will be allocated, space will be allocated for the data passed in
| after | Pointer to the list element to insert after |
| data | Pointer to the data to insert |
| size | Size of the data to insert |
| parentPtr | Will be filled in with a pointer to the ListItem that this method allocates |
Inserts the given list element after the specified list element
| after | Pointer to the list element to insert after |
| pNewNode | A previously allocated ListItem to insert |
Inserts the given list element before the specified list element
| before | Pointer to the list element to insert before |
| pNewNode | A previously allocated ListItem to insert |
| int IsEmpty | ( | ) |
Returns whether or not the list is empty
| void Iterator | ( | ListIterator | func, |
| void * | data, | ||
| ListIteratorDirection | direction | ||
| ) |
Iterates through the list in the specified direction, calling the supplied function on each element and passing the supplied data to that function
| func | ListIterator function to call |
| data | Data that will be supplied to each call of the list iterator function |
| direction | Which directon to iterate |
| ListItem * Last | ( | ) |
| ListItem * Nth | ( | int | where | ) |
| void Push | ( | const void * | data, |
| int | size | ||
| ) |
Inserts the given data at the front of the list. A new ListItem will be allocated, space will be allocated for the data passed in
| data | Pointer to the data to insert |
| size | Size of the data to insert |
| void Push | ( | const void * | data, |
| int | size, | ||
| void ** | parentPtr | ||
| ) |
| void Push | ( | ListItem * | pNewNode | ) |
Inserts the given list element at the front of the list
| pNewNode | A previously allocated ListItem to insert |