RAVE
|
Implementation of a rave object list that ensures that the objects contained within the list are released upon destruction etc. More...
#include "rave_object.h"
Go to the source code of this file.
Typedefs | |
typedef struct _RaveObjectList_t | RaveObjectList_t |
Defines a list. | |
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.
This object supports RAVE_OBJECT_CLONE with an exception, if any members of the list is not possible to clone, they will not be added to the list which means that the returned list might have fewer entries.
typedef struct _RaveObjectList_t RaveObjectList_t |
Defines a list.
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. |
|
extern |
Type definition to use when creating a rave object.