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

Header file for Array container type.

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

Go to the source code of this file.

Macros

#define bj_array_new_t(T)
 Creates a new bj_array with a payload size inferred from the type T.
 

Typedefs

typedef struct bj_array_t bj_array
 Typedef for the bj_array_t struct.
 

Functions

bj_arraybj_array_new (size_t bytes_payload)
 Creates a new bj_array with a payload size specified in bytes.
 
void bj_array_del (bj_array *p_array)
 Deletes a bj_array object and releases associated memory.
 
bj_arraybj_array_alloc (void)
 Allocate enough memory to hold an Array object.
 
bj_arraybj_array_init (bj_array *p_instance, size_t bytes_payload)
 Initialize a new array with given size.
 
void bj_array_reset (bj_array *p_array)
 Resets the entire array object, making it suitable for free.
 
void bj_array_clear (bj_array *array)
 Clears all elements in the array.
 
void bj_array_shrink (bj_array *array)
 Shrinks the memory allocation to fit the current array length.
 
void bj_array_set_len (bj_array *array, size_t len)
 Resizes the array to the specified length.
 
void bj_array_reserve (bj_array *array, size_t capacity)
 Reserves memory for up to capacity elements in the array.
 
void bj_array_push (bj_array *array, const void *value)
 Appends a value to the end of the array.
 
void bj_array_pop (bj_array *array)
 Removes the last value from the array.
 
void * bj_array_at (const bj_array *array, size_t at)
 Retrieves the value stored at the specified index in the array.
 
void * bj_array_data (const bj_array *array)
 Retrieves a pointer to the underlying data of the array.
 
size_t bj_array_len (const bj_array *array)
 Retrieves the number of elements in the array.
 
size_t bj_array_capacity (const bj_array *array)
 Retrieves the current capacity of the array.