| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #ifndef SL_LIST_H__
- # define SL_LIST_H__
- struct sl_list_item {
- void *data;
- struct sl_list_item *next;
- };
- typedef struct {
- unsigned int count;
- struct sl_list_item *first;
- } sl_list;
- /**
- * Allocate a new list and return it
- * result should be unallocated with sllist_destroy()
- **/
- sl_list *sllist_create();
- /**
- * Free all ressources allocated by sllist_create
- **/
- void sllist_destroy(sl_list *list);
- /**
- * Get the numbers of items contained in sl_list
- **/
- unsigned int sllist_count(const sl_list * const list);
- /**
- * Add an item at the end of the list
- * TODO
- **/
- sl_list *sllist_pushback(sl_list *list, void *item);
- /**
- * Add an item at the begining of the list
- * TODO
- **/
- sl_list *sllist_pushfront(sl_list *list, void *item);
- /**
- * Remove the last item of the list and return it
- * TODO
- **/
- void *sllist_popback(sl_list *list, void *item);
- /**
- * Remove the first item of the list and return it
- * TODO
- **/
- void *sllist_popfront(sl_list *list, void *item);
- /**
- * Get the item at position %pos
- * TODO
- **/
- void *sllist_at(sl_list *list, unsigned int pos);
- /**
- * Remove the item at position %pos, and return it
- * TODO
- **/
- void *sllist_removeat(sl_list *list, unsigned int pos);
- /**
- * Remove all elements
- **/
- sl_list *sllist_clear(sl_list *list);
- #endif /* SL_LIST_H__ */
|