slist.h

Go to the documentation of this file.
00001 /* Header for Services list handler.
00002  *
00003  * (C) 2003-2007 Anope Team
00004  * Contact us at info@anope.org
00005  *
00006  * Please read COPYING and README for furhter details.
00007  *
00008  * Based on the original code of Epona by Lara.
00009  * Based on the original code of Services by Andy Church. 
00010  * 
00011  * $Id: slist.h 1265 2007-08-26 15:33:06Z geniusdex $ 
00012  *
00013  */
00014  
00015 #ifndef SLIST_H
00016 #define SLIST_H
00017  
00018 typedef struct slist_ SList;
00019 typedef struct slistopts_ SListOpts;
00020 
00021 struct slist_ {
00022     void **list;
00023     
00024     int16 count;        /* Total entries of the list */
00025     int16 capacity;     /* Capacity of the list */
00026     int16 limit;        /* Maximum possible entries on the list */
00027     
00028     SListOpts *opts;
00029 };
00030 
00031 struct slistopts_ {
00032     int32 flags;        /* Flags for the list. See below. */
00033     
00034     int  (*compareitem) (SList *slist, void *item1, void *item2);   /* Called to compare two items */
00035     int  (*isequal)     (SList *slist, void *item1, void *item2);   /* Called by slist_indexof. item1 can be an arbitrary pointer. */
00036     void (*freeitem)    (SList *slist, void *item);                 /* Called when an item is removed */
00037 };
00038 
00039 #define SLIST_DEFAULT_LIMIT 32767
00040 
00041 #define SLISTF_NODUP    0x00000001      /* No duplicates in the list. */
00042 #define SLISTF_SORT     0x00000002      /* Automatically sort the list. Used with compareitem member. */
00043 
00044 /* Note that number is the index in the array + 1 */
00045 typedef int (*slist_enumcb_t) (SList *slist, int number, void *item, va_list args);
00046 /* Callback to know whether we can delete the entry. */
00047 typedef int (*slist_delcheckcb_t) (SList *slist, void *item, va_list args);
00048 
00049 #endif /* SLIST_H */
00050 

Generated on Sun Dec 30 09:26:45 2007 for Anope by  doxygen 1.5.1-20070107