3 ** The list object is a generic container for storing collections
9 #include "HTUtils.h" /* for BOOL type and PARAMS and ARGS*/
11 typedef struct _HTList HTList;
19 #define HTList_new HTLiNew
20 #define HTList_delete HTLiDele
21 #define HTList_addObject HTLiAdOb
22 #define HTList_removeObject HTLiReOb
23 #define HTList_removeLastObject HTLiReLa
24 #define HTList_removeFirstObject HTLiReFi
25 #define HTList_count HTLiCoun
26 #define HTList_indexOf HTLiInOf
27 #define HTList_objectAt HTLiObAt
30 extern HTList * HTList_new NOPARAMS;
31 extern void HTList_delete PARAMS((HTList *this));
32 extern void HTList_addObject PARAMS((HTList *this, void *newObject));
33 extern BOOL HTList_removeObject PARAMS((HTList *this, void *oldObject));
34 extern void * HTList_removeLastObject PARAMS((HTList *this));
35 extern void * HTList_removeFirstObject PARAMS((HTList *this));
36 #define HTList_isEmpty(this) (this ? this->next == NULL : YES)
37 extern int HTList_count PARAMS((HTList *this));
38 extern int HTList_indexOf PARAMS((HTList *this, void *object));
39 #define HTList_lastObject(this) \
40 (this && this->next ? this->next->object : NULL)
41 extern void * HTList_objectAt PARAMS((HTList *this, int position));
43 /* Fast macro to traverse the list. Call it first with copy of list header :
44 it returns the first object and increments the passed list pointer.
45 Call it with the same variable until it returns NULL. */
46 #define HTList_nextObject(this) \
47 (this && (this = this->next) ? this->object : NULL)