00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
#ifndef __GI_LIST_H
00018
#define __GI_LIST_H
00019
00020
00021
00032
00033
00037 typedef struct gi_list_link
00038 {
00039
struct gi_list_link *prev;
00040
struct gi_list_link *next;
00041 void *
data;
00042 }
GiListLink;
00043
00049 typedef struct gi_list
00050 {
00051 GiListLink *
bol;
00052 GiListLink *
eol;
00053 unsigned int nelem;
00054 }
GiList;
00055
00059 #define GI_LIST_LINK(gilist) ((gilist)->bol)
00060
00061
00062
00074 typedef int (*
GiListCompareFn) (
const void *a,
const void *b);
00075
#define GI_LIST_CMP(cmpfn) ((GiListCompareFn)(cmpfn))
00076
00085 typedef void (*
GiListForeachFn) (
const void *data,
const void *udata);
00086
#define GI_LIST_FOREACH(foreachfn) ((GiListForeachFn)(foreachfn))
00087
00088
typedef int (*GiListForeachExFn) (
const void *data,
const void *udata);
00089
#define GI_LIST_FOREACH_EX(foreachfn) ((GiListForeachExFn)(foreachfn))
00090
00091
00092
00093 EXTERN_C_BEGIN
00094
00095
00096
00100 LIBGIFT_EXPORT
00101
GiList *gi_list_new (
void);
00102
00108 LIBGIFT_EXPORT
00109
void gi_list_destroy (
GiList **listref);
00110
00111
00112
00127 LIBGIFT_EXPORT
00128
GiListLink *gi_list_append (
GiList **listref,
const void *data);
00129
00133 LIBGIFT_EXPORT
00134
GiListLink *gi_list_prepend (
GiList **listref,
const void *data);
00135
00136
00137
00153 LIBGIFT_EXPORT
00154
GiListLink *gi_list_insert (
GiList **listref,
GiListLink *pos,
00155
const void *data);
00156
00171 LIBGIFT_EXPORT
00172
GiListLink *gi_list_insort (
GiList **listref, GiListCompareFn cmpfn,
00173
const void *data);
00174
00175
00176
00184 LIBGIFT_EXPORT
00185
bool gi_list_remove (
GiList **listref,
const void *data);
00186
00192 LIBGIFT_EXPORT
00193
void gi_list_removel (
GiList **listref,
GiListLink *link);
00194
00195
00196
00201 LIBGIFT_EXPORT
00202
unsigned int gi_list_length (
GiList *list);
00203
00204
00205
00219 LIBGIFT_EXPORT
00220
GiListLink *gi_listl_nth (
GiListLink *link,
int n);
00221
00222
#define gi_listl_nth_data(link,n) \
00223
gi_listl_data(gi_listl_nth(link,n))
00224
00230 LIBGIFT_EXPORT
00231
GiListLink *gi_list_nth (
GiList *list,
int n);
00232
00233
#define gi_list_nth_data(list,n) \
00234
gi_listl_data(gi_list_nth(list,n))
00235
00239 LIBGIFT_EXPORT
00240
void *gi_listl_data (
GiListLink *link);
00241
00242
00243
00251 LIBGIFT_EXPORT
00252
GiListLink *gi_list_find (
GiList *list, GiListCompareFn cmpfn,
00253
const void *udata);
00254
00260 LIBGIFT_EXPORT
00261
void gi_list_foreach (
GiList *list, GiListForeachFn foreachfn,
00262
const void *udata);
00263
00267 LIBGIFT_EXPORT
00268
void gi_list_foreachex (
GiList **listref, GiListForeachExFn foreachfn,
00269
const void *udata);
00270
00271
00272
00276 LIBGIFT_EXPORT
00277
void gi_list_sort (
GiList **listref, GiListCompareFn cmpfn);
00278
00279
00280
00281 EXTERN_C_END
00282
00283
00284
00285
#endif