(my)TinyLibC 0.0.1
little tiny pretty lib c
Loading...
Searching...
No Matches
tlcdico.h File Reference
#include <tlcllists.h>

Go to the source code of this file.

Data Structures

struct  dico_t
 
struct  dico_node_t
 

Functions

dico_t * dico_create (void)
 create a new dico
 
void dico_destroy (dico_t *dico)
 delete a dico
 
dico_t * dico_add (dico_t *dico, char const *key, void *value, void(*destroy)(void *value))
 add a key/value
 
dico_t * dico_add_elem (dico_t *dico, dico_node_t *elem)
 add an elem (key/value/destroy)
 
void * dico_pop_value (dico_t *dico, char const *key)
 remove a key and return the value
 
dico_node_t * dico_pop_elem (dico_t *dico, char const *key)
 remove a key and return the node
 
void * dico_get_value (dico_t *dico, char const *key)
 Get value of pair key.
 
dico_node_t * dico_get_elem (dico_t *dico, char const *key)
 Get node of pair key.
 
dico_node_t * dico_get_elem_ptr (dico_t *dico, void *value)
 Get node where value equal value in node.
 
dico_t * dico_rem (dico_t *dico, char const *key)
 Rem a key and its value.
 
dico_t * dico_rem_ptr (dico_t *dico, void *value)
 Rem a key and its value.
 

Function Documentation

◆ dico_add()

dico_t * dico_add ( dico_t *  dico,
char const *  key,
void *  value,
void(*)(void *value)  destroy 
)

add a key/value

Parameters
dicodico
keykey
valuevalue
destroydestroy function to free the value (could be null)
Returns
dico

◆ dico_add_elem()

dico_t * dico_add_elem ( dico_t *  dico,
dico_node_t *  elem 
)

add an elem (key/value/destroy)

Parameters
dicodico
elemelem
Returns
dico

◆ dico_create()

dico_t * dico_create ( void  )

create a new dico

Returns
dico

◆ dico_destroy()

void dico_destroy ( dico_t *  dico)

delete a dico

Parameters
dicoto delete

◆ dico_get_elem()

dico_node_t * dico_get_elem ( dico_t *  dico,
char const *  key 
)

Get node of pair key.

Parameters
dicodico
keykey
Returns
node

◆ dico_get_elem_ptr()

dico_node_t * dico_get_elem_ptr ( dico_t *  dico,
void *  value 
)

Get node where value equal value in node.

Parameters
dicodico
valuevalue
Returns
node

◆ dico_get_value()

void * dico_get_value ( dico_t *  dico,
char const *  key 
)

Get value of pair key.

Parameters
dicodico
keykey
Returns
value

◆ dico_pop_elem()

dico_node_t * dico_pop_elem ( dico_t *  dico,
char const *  key 
)

remove a key and return the node

Parameters
dicodico
keykey
Returns
node

◆ dico_pop_value()

void * dico_pop_value ( dico_t *  dico,
char const *  key 
)

remove a key and return the value

Parameters
dicodico
keykey
Returns
value

◆ dico_rem()

dico_t * dico_rem ( dico_t *  dico,
char const *  key 
)

Rem a key and its value.

Parameters
dicodico
keykey
Returns
dico

◆ dico_rem_ptr()

dico_t * dico_rem_ptr ( dico_t *  dico,
void *  value 
)

Rem a key and its value.

Parameters
dicodico
valuevalue of key/value pair
Returns
dico