Anope IRC Services  Version 1.8
slist.h
Go to the documentation of this file.
1 /* Header for Services list handler.
2  *
3  * (C) 2003-2014 Anope Team
4  * Contact us at team@anope.org
5  *
6  * Please read COPYING and README for further details.
7  *
8  * Based on the original code of Epona by Lara.
9  * Based on the original code of Services by Andy Church.
10  *
11  *
12  */
13 
14 #ifndef SLIST_H
15 #define SLIST_H
16 
17 typedef struct slist_ SList;
18 typedef struct slistopts_ SListOpts;
19 
20 struct slist_ {
21  void **list;
22 
23  int16 count; /* Total entries of the list */
24  int16 capacity; /* Capacity of the list */
25  int16 limit; /* Maximum possible entries on the list */
26 
28 };
29 
30 struct slistopts_ {
31  int32 flags; /* Flags for the list. See below. */
32 
33  int (*compareitem) (SList *slist, void *item1, void *item2); /* Called to compare two items */
34  int (*isequal) (SList *slist, void *item1, void *item2); /* Called by slist_indexof. item1 can be an arbitrary pointer. */
35  void (*freeitem) (SList *slist, void *item); /* Called when an item is removed */
36 };
37 
38 #define SLIST_DEFAULT_LIMIT 32767
39 
40 #define SLISTF_NODUP 0x00000001 /* No duplicates in the list. */
41 #define SLISTF_SORT 0x00000002 /* Automatically sort the list. Used with compareitem member. */
42 
43 /* Note that number is the index in the array + 1 */
44 typedef int (*slist_enumcb_t) (SList *slist, int number, void *item, va_list args);
45 /* Callback to know whether we can delete the entry. */
46 typedef int (*slist_delcheckcb_t) (SList *slist, void *item, va_list args);
47 
48 #endif /* SLIST_H */
49 
int(* isequal)(SList *slist, void *item1, void *item2)
Definition: slist.h:34
SListOpts * opts
Definition: slist.h:27
void ** list
Definition: slist.h:21
int16 limit
Definition: slist.h:25
int16 count
Definition: slist.h:23
int(* slist_enumcb_t)(SList *slist, int number, void *item, va_list args)
Definition: slist.h:44
int32_t int32
Definition: db-merger.c:122
int32 flags
Definition: slist.h:31
int16_t int16
Definition: db-merger.c:120
Definition: slist.h:20
int(* slist_delcheckcb_t)(SList *slist, void *item, va_list args)
Definition: slist.h:46
void(* freeitem)(SList *slist, void *item)
Definition: slist.h:35
int16 capacity
Definition: slist.h:24
int(* compareitem)(SList *slist, void *item1, void *item2)
Definition: slist.h:33