Banjo API 0.0.1
Multi-purpose C99 API
Loading...
Searching...
No Matches
list.h File Reference

Header file for List container type.

#include <banjo/api.h>
#include <banjo/memory.h>
Include dependency graph for list.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bj_list_iterator_t
 Structure representing a list iterator. More...
 

Macros

#define bj_list_new_t(T)
 Creates a new bj_list with type inference for elements.
 

Typedefs

typedef struct bj_list_t bj_list
 Typedef for the BList_t struct.
 
typedef struct bj_list_iterator_t bj_list_iterator
 Typedef for the bj_list_iterator_t structure.
 

Functions

bj_listbj_list_alloc (void)
 Allocate a new bj_list object in memory.
 
bj_listbj_list_new (size_t bytes_payload)
 Creates a new bj_list with the specified payload size.
 
void bj_list_del (bj_list *p_list)
 Deletes a bj_list object and releases associated memory.
 
bj_listbj_list_init (bj_list *p_list, size_t bytes_payload)
 Initializes the given list.
 
void bj_list_clear (bj_list *list)
 Clears all data in the list.
 
void bj_list_reset (bj_list *p_list)
 Reset the given list.
 
size_t bj_list_len (bj_list *list)
 Returns the number of elements in the given list.
 
void * bj_list_insert (bj_list *list, size_t index, void *p_data)
 Inserts a new element at the specified index and returns a pointer to it.
 
void * bj_list_prepend (bj_list *list, void *p_data)
 Inserts a new element at position 0 and returns a pointer to it.
 
void * bj_list_at (bj_list *list, size_t index)
 Returns the value of the element at the specified index.
 
void * bj_list_head (bj_list *list)
 Returns the value of the first element in the list.
 
bj_list_iteratorbj_list_iterator_new (bj_list *list)
 Creates a forward-only iterator for the given list.
 
void bj_list_iterator_del (bj_list_iterator *iterator)
 Destroys the given list iterator.
 
void bj_list_iterator_init (bj_list *p_list, bj_list_iterator *p_iterator)
 Initializes a list iterator.
 
void bj_list_iterator_reset (bj_list_iterator *p_iterator)
 Resets a list iterator.
 
bj_bool bj_list_iterator_has_next (bj_list_iterator *iterator)
 Returns BJ_TRUE if the iterator has more elements.
 
void * bj_list_iterator_next (bj_list_iterator *iterator)
 Returns the next element in the iteration.