2 docCopyright("Steve Dekorte", 2002)
3 docLicense("BSD revised")
5 List - an array of void pointers
6 User is responsible for io_freeing items
11 #define LIST_DEFINED 1
22 #ifdef LOW_MEMORY_SYSTEM
23 #define LIST_START_SIZE 1
24 #define LIST_RESIZE_FACTOR 2
26 #define LIST_START_SIZE 1
27 #define LIST_RESIZE_FACTOR 2
30 #define LIST_AT_(self, n) self->items[n]
33 typedef void (ListDoCallback
)(void *);
34 typedef void (ListDoWithCallback
)(void *, void *);
35 typedef void *(ListCollectCallback
)(void *);
36 typedef int (ListSelectCallback
)(void *);
37 typedef int (ListDetectCallback
)(void *);
38 typedef int (ListSortCallback
)(const void *, const void *);
39 typedef int (ListCompareFunc
)(const void *, const void *);
54 BASEKIT_API List
*List_new(void);
55 BASEKIT_API List
*List_clone(const List
*self
);
56 BASEKIT_API List
*List_cloneSlice(const List
*self
, long startIndex
, long endIndex
);
58 BASEKIT_API
void List_free(List
*self
);
59 BASEKIT_API
void List_removeAll(List
*self
);
60 BASEKIT_API
void List_copy_(List
*self
, const List
*otherList
);
61 BASEKIT_API
int List_equals_(const List
*self
, const List
*otherList
);
62 BASEKIT_API
size_t List_memorySize(const List
*self
);
66 BASEKIT_API UArray
List_asStackAllocatedUArray(List
*self
);
70 BASEKIT_API
void List_preallocateToSize_(List
*self
, size_t index
);
71 BASEKIT_API
void List_setSize_(List
*self
, size_t index
);
72 BASEKIT_API
void List_compact(List
*self
);
76 BASEKIT_API
void List_print(const List
*self
);
77 BASEKIT_API
void List_sliceInPlace(List
*self
, long startIndex
, long endIndex
);
81 BASEKIT_API
void List_do_(List
*self
, ListDoCallback
*callback
);
82 BASEKIT_API
void List_do_with_(List
*self
, ListDoWithCallback
*callback
, void *arg
);
84 BASEKIT_API List
*List_map_(List
*self
, ListCollectCallback
*callback
);
85 BASEKIT_API
void List_mapInPlace_(List
*self
, ListCollectCallback
*callback
);
86 BASEKIT_API
void *List_detect_(List
*self
, ListDetectCallback
*callback
);
87 BASEKIT_API List
*List_select_(List
*self
, ListSelectCallback
*callback
);
89 BASEKIT_API
void *List_anyOne(const List
*self
);
90 BASEKIT_API
void List_shuffle(List
*self
);
91 BASEKIT_API
void *List_removeLast(List
*self
);
93 #include "List_inline.h"