typedef struct { } OmtkList;
You shouldn't access this structure directly, because it may change.
#define OMTK_LIST_FOREACH(list, var)
The block followed by this instruction is invoked for every object of list. It is possible to add or remove elements of the same list in this block! The object of the list will be stored in var. Note that this is a preprocessor directive and take a look at the example.
Do not put a semicolon behind this instruction!
Example:
OmtkList *list = omtk_list_create(); int var; omtk_list_append(list, (void *)1); omtk_list_append(list, (void *)2); omtk_list_append(list, (void *)3); OMTK_LIST_FOREACH(list, &var) /* do NOT use any casting operators here */ { printf("%d\n", var); }
OmtkList *omtk_list_create(void);
Creates a new list.
void omtk_list_append(OmtkList *list, void *object);
Appends an object to a list.
void omtk_list_insert_at(OmtkList *list, int position, void *object);
Inserts an object at the given position.
int omtk_list_remove(OmtkList *list, void *object);
Removes the first occurence of object from the list. Returns 1 if the object was removed or 0 if the object isn't in the list.
Added in omtk 0.1.2.
void omtk_list_remove_at(OmtkList *list, int position);
Removes the object at the given position from the list.
void omtk_list_rewind(OmtkList *list);
Sets the element pointer of the list to the begin of the list.
If you want to traverse the list, use OMTK_LIST_FOREACH().
int omtk_list_next(OmtkList *list, void **var);
Returns the current element pointer and sets it to the next element.
If you want to traverse the list, use OMTK_LIST_FOREACH().
Added in omtk 0.1.2.
void *omtk_list_object_at(OmtkList *list, int position);
Returns the object at the given position of the list.
int omtk_list_count(OmtkList *list);
Returns the number of elements of the list.
void omtk_list_print(OmtkList *list);
Prints the list. This function should be used for debugging purposes only.
void omtk_list_free(OmtkList *list);
You have to call this function to free the list.
Zurück zu www.eggdrop.ch | Back to www.eggdrop.ch Last update: 20.02.04 |
Copyright (C) 2004, 2005 by Thomas "tom" Steinacher <tom at eggdrop.ch> |