HTP
0.3
|
#include "bstr.h"
Go to the source code of this file.
Data Structures | |
struct | list_t |
struct | list_linked_element_t |
struct | list_linked_t |
struct | list_array_t |
struct | table_t |
Defines | |
#define | list_push(L, E) (L)->push(L, E) |
#define | list_pop(L) (L)->pop(L) |
#define | list_empty(L) (L)->empty(L) |
#define | list_get(L, N) (L)->get((list_t *)L, N) |
#define | list_replace(L, N, E) (L)->replace((list_t *)L, N, E) |
#define | list_add(L, N) (L)->push(L, N) |
#define | list_size(L) (L)->size(L) |
#define | list_iterator_reset(L) (L)->iterator_reset(L) |
#define | list_iterator_next(L) (L)->iterator_next(L) |
#define | list_destroy(L) (*(L))->destroy(L) |
#define | list_shift(L) (L)->shift(L) |
#define | LIST_COMMON |
Typedefs | |
typedef struct list_t | list_t |
typedef struct list_array_t | list_array_t |
typedef struct list_linked_element_t | list_linked_element_t |
typedef struct list_linked_t | list_linked_t |
typedef struct table_t | table_t |
Functions | |
list_t * | list_linked_create (void) |
void | list_linked_destroy (list_linked_t **_l) |
list_t * | list_array_create (size_t size) |
void | list_array_iterator_reset (list_array_t *l) |
void * | list_array_iterator_next (list_array_t *l) |
void | list_array_destroy (list_array_t **_l) |
table_t * | table_create (size_t size) |
int | table_add (table_t *, bstr *, void *) |
int | table_addn (table_t *, bstr *, void *) |
void | table_set (table_t *, bstr *, void *) |
void * | table_get (const table_t *, const bstr *) |
void * | table_get_c (const table_t *, const char *) |
void | table_iterator_reset (table_t *) |
bstr * | table_iterator_next (table_t *, void **) |
size_t | table_size (const table_t *t) |
void | table_destroy (table_t **) |
void | table_clear (table_t *) |
#define list_add | ( | L, | |
N | |||
) | (L)->push(L, N) |
#define LIST_COMMON |
int (*push)(list_t *, void *); \ void *(*pop)(list_t *); \ int (*empty)(const list_t *); \ void *(*get)(const list_t *, size_t index); \ int (*replace)(list_t *, size_t index, void *); \ size_t (*size)(const list_t *); \ void (*iterator_reset)(list_t *); \ void *(*iterator_next)(list_t *); \ void (*destroy)(list_t **); \ void *(*shift)(list_t *)
#define list_destroy | ( | L | ) | (*(L))->destroy(L) |
#define list_empty | ( | L | ) | (L)->empty(L) |
#define list_iterator_next | ( | L | ) | (L)->iterator_next(L) |
#define list_iterator_reset | ( | L | ) | (L)->iterator_reset(L) |
#define list_pop | ( | L | ) | (L)->pop(L) |
#define list_push | ( | L, | |
E | |||
) | (L)->push(L, E) |
#define list_replace | ( | L, | |
N, | |||
E | |||
) | (L)->replace((list_t *)L, N, E) |
#define list_shift | ( | L | ) | (L)->shift(L) |
#define list_size | ( | L | ) | (L)->size(L) |
typedef struct list_array_t list_array_t |
typedef struct list_linked_element_t list_linked_element_t |
typedef struct list_linked_t list_linked_t |
list_t* list_array_create | ( | size_t | size | ) |
Create new array-based list.
size |
void list_array_destroy | ( | list_array_t ** | _l | ) |
Free the memory occupied by this list. This function assumes the data elements were freed beforehand.
l |
void* list_array_iterator_next | ( | list_array_t * | l | ) |
Advance to the next list value.
l |
void list_array_iterator_reset | ( | list_array_t * | l | ) |
Reset the list iterator.
l |
list_t* list_linked_create | ( | void | ) |
Create a new linked list.
void list_linked_destroy | ( | list_linked_t ** | _l | ) |
Destroy list. This function will not destroy any of the data stored in it. You'll have to do that manually beforehand.
l |
int table_addn | ( | table_t * | table, |
bstr * | key, | ||
void * | element | ||
) |
Add a new table element. This function currently makes a copy of the key, which is inefficient.
table | |
key | |
element |
void table_clear | ( | table_t * | table | ) |
Remove all elements from the table.
table |
table_t* table_create | ( | size_t | size | ) |
Create a new table structure.
size |
void table_destroy | ( | table_t ** | _table | ) |
Destroy a table.
table |
Retrieve the first element in the table with the given key.
table | |
key |
void* table_get_c | ( | const table_t * | table, |
const char * | cstr | ||
) |
table | |
key | Retrieve the first element in the table with the given key (as a NUL-terminated string). |
table | |
cstr |
bstr* table_iterator_next | ( | table_t * | t, |
void ** | data | ||
) |
Advance to the next table element.
t | |
data |
void table_iterator_reset | ( | table_t * | table | ) |
Reset the table iterator.
table |
size_t table_size | ( | const table_t * | table | ) |
Returns the size of the table.
table |