RAVE
|
Implementation of a rave object list that ensures that the objects contained within the list are released upon destruction etc. More...
#include "rave_list.h"
#include "raveobject_list.h"
#include "rave_debug.h"
#include "rave_alloc.h"
#include <string.h>
#include <stdio.h>
Classes | |
struct | _RaveObjectList_t |
Represents a list. More... | |
Functions | |
int | RaveObjectList_add (RaveObjectList_t *list, RaveCoreObject *obj) |
Add one instance to the list. | |
int | RaveObjectList_insert (RaveObjectList_t *list, int index, RaveCoreObject *obj) |
Inserts the object at the specified index, if index < 0 or index > size, then this function will add the object to the end of the list. | |
int | RaveObjectList_size (RaveObjectList_t *list) |
Returns the number of items in this list. | |
RaveCoreObject * | RaveObjectList_get (RaveObjectList_t *list, int index) |
Returns the item at the specified position. | |
RaveCoreObject * | RaveObjectList_getLast (RaveObjectList_t *list) |
Returns the item at the end. | |
RaveCoreObject * | RaveObjectList_remove (RaveObjectList_t *list, int index) |
Removes the item at the specified position and returns it. | |
void | RaveObjectList_release (RaveObjectList_t *list, int index) |
Removes the item at the specified position and releases it. | |
void | RaveObjectList_clear (RaveObjectList_t *list) |
Removes all entries from the list. | |
RaveCoreObject * | RaveObjectList_removeLast (RaveObjectList_t *list) |
Removes the last item. | |
void | RaveObjectList_sort (RaveObjectList_t *list, int(*sortfun)(const void *, const void *)) |
Sorts the list according to the provided sort function. | |
int | RaveObjectList_indexOf (RaveObjectList_t *list, RaveCoreObject *obj) |
Locates the object at returns the index in the list. | |
Variables | |
RaveCoreObjectType | RaveObjectList_TYPE |
Type definition to use when creating a rave object. | |
Implementation of a rave object list that ensures that the objects contained within the list are released upon destruction etc.
int RaveObjectList_add | ( | RaveObjectList_t * | list, |
RaveCoreObject * | obj ) |
Add one instance to the list.
[in] | list | - the list |
[in] | obj | - the object |
void RaveObjectList_clear | ( | RaveObjectList_t * | list | ) |
Removes all entries from the list.
[in] | list | - the list |
RaveCoreObject * RaveObjectList_get | ( | RaveObjectList_t * | list, |
int | index ) |
Returns the item at the specified position.
[in] | list | - the list |
[in] | index | - the index of the requested item |
RaveCoreObject * RaveObjectList_getLast | ( | RaveObjectList_t * | list | ) |
Returns the item at the end.
[in] | list | - the list |
int RaveObjectList_indexOf | ( | RaveObjectList_t * | list, |
RaveCoreObject * | obj ) |
Locates the object at returns the index in the list.
The comparision is based on addresses.
[in] | list | - the list @obj[in] the object to find |
int RaveObjectList_insert | ( | RaveObjectList_t * | list, |
int | index, | ||
RaveCoreObject * | obj ) |
Inserts the object at the specified index, if index < 0 or index > size, then this function will add the object to the end of the list.
[in] | list | - the list |
[in] | index | - the index where to insert the object |
[in] | obj | - the object to insert. |
void RaveObjectList_release | ( | RaveObjectList_t * | list, |
int | index ) |
Removes the item at the specified position and releases it.
[in] | list | - the list |
[in] | index | - the index of the requested item |
RaveCoreObject * RaveObjectList_remove | ( | RaveObjectList_t * | list, |
int | index ) |
Removes the item at the specified position and returns it.
[in] | list | - the list |
[in] | index | - the index of the requested item |
RaveCoreObject * RaveObjectList_removeLast | ( | RaveObjectList_t * | list | ) |
Removes the last item.
[in] | list | - the list |
int RaveObjectList_size | ( | RaveObjectList_t * | list | ) |
Returns the number of items in this list.
[in] | list | - the list |
void RaveObjectList_sort | ( | RaveObjectList_t * | list, |
int(* | sortfun )(const void *, const void *) ) |
Sorts the list according to the provided sort function.
The sort function should return an integer less than, equal to or greater than zero depending on how the first argument is in relation to the second argument.
[in] | list | - the list |
[in] | sortfun | - the sorting function. |
RaveCoreObjectType RaveObjectList_TYPE |
Type definition to use when creating a rave object.