libonion
|
Enumerations | |
enum | onion_dict_flags_e { OD_FREE_KEY = 2, OD_FREE_VALUE = 4, OD_FREE_ALL = 6, OD_DUP_KEY = 0x12, OD_DUP_VALUE = 0x24, OD_DUP_ALL = 0x36, OD_REPLACE = 0x040, OD_STRING = 0, OD_DICT = 0x0100, OD_TYPE_MASK = 0x0FF00, OD_ICASE = 0x01 } |
Flags to change some parameters of each key. More... |
Functions | |
onion_dict * | onion_dict_new () |
Initializes a dict. | |
void | onion_dict_set_flags (onion_dict *dict, int flags) |
void | onion_dict_add (onion_dict *dict, const char *key, const void *value, int flags) |
Adds a value. Flags are or from onion_dict_flags_e, for example OD_DUP_ALL. | |
int | onion_dict_remove (onion_dict *dict, const char *key) |
Removes a value. | |
void | onion_dict_free (onion_dict *dict) |
Removes the full dict struct form mem. | |
void | onion_dict_merge (onion_dict *me, const onion_dict *other) |
Merges argument dictionary into current. | |
onion_dict * | onion_dict_dup (onion_dict *dict) |
Creates a soft duplicate of the dict. | |
onion_dict * | onion_dict_hard_dup (onion_dict *dict) |
Creates a hard duplicate of the dict. | |
const char * | onion_dict_get (const onion_dict *dict, const char *key) |
Gets a value. | |
const char * | onion_dict_rget (const onion_dict *dict, const char *key,...) |
Gets a value, recursively over the nested dicts, until NULL. | |
onion_dict * | onion_dict_get_dict (const onion_dict *dict, const char *key) |
Gets a dict. It ensures its a dict. | |
onion_dict * | onion_dict_rget_dict (const onion_dict *dict, const char *key,...) |
Gets a dict. It ensures its a dict. Recursively until NULL. | |
void | onion_dict_print_dot (const onion_dict *dict) |
Prints a dot ready graph to stderr. | |
void | onion_dict_preorder (const onion_dict *dict, void *func, void *data) |
Visits the full graph in preorder, calling that function on each node. void func(void *data, const char *key, const void *value, int flags). | |
int | onion_dict_count (const onion_dict *dict) |
Counts elements. | |
onion_block * | onion_dict_to_json (onion_dict *dict) |
Converts a dict into a JSON onion_block. | |
onion_dict * | onion_dict_from_json (const char *data) |
Converts a C string into a dictionary. | |
lock management | |
Locks for reading. Several can read, one can write. | |
void | onion_dict_lock_read (const onion_dict *dict) |
void | onion_dict_lock_write (onion_dict *dict) |
Locks for writing. | |
void | onion_dict_unlock (onion_dict *dict) |
Unlocks last lock. |
void onion_dict_add | ( | onion_dict * | dict, |
const char * | key, | ||
const void * | value, | ||
int | flags | ||
) |
Adds a value. Flags are or from onion_dict_flags_e, for example OD_DUP_ALL.
int onion_dict_count | ( | const onion_dict * | dict | ) |
Counts elements.
onion_dict* onion_dict_dup | ( | onion_dict * | dict | ) |
Creates a soft duplicate of the dict.
void onion_dict_free | ( | onion_dict * | dict | ) |
Removes the full dict struct form mem.
const char* onion_dict_get | ( | const onion_dict * | dict, |
const char * | key | ||
) |
Gets a value.
onion_dict* onion_dict_get_dict | ( | const onion_dict * | dict, |
const char * | key | ||
) |
Gets a dict. It ensures its a dict.
onion_dict* onion_dict_hard_dup | ( | onion_dict * | dict | ) |
Creates a hard duplicate of the dict.
void onion_dict_lock_read | ( | const onion_dict * | dict | ) |
void onion_dict_lock_write | ( | onion_dict * | dict | ) |
Locks for writing.
onion_dict* onion_dict_new | ( | ) |
Initializes a dict.
void onion_dict_preorder | ( | const onion_dict * | dict, |
void * | func, | ||
void * | data | ||
) |
Visits the full graph in preorder, calling that function on each node. void func(void *data, const char *key, const void *value, int flags).
void onion_dict_print_dot | ( | const onion_dict * | dict | ) |
Prints a dot ready graph to stderr.
int onion_dict_remove | ( | onion_dict * | dict, |
const char * | key | ||
) |
Removes a value.
const char* onion_dict_rget | ( | const onion_dict * | dict, |
const char * | key, | ||
... | |||
) |
Gets a value, recursively over the nested dicts, until NULL.
onion_dict* onion_dict_rget_dict | ( | const onion_dict * | dict, |
const char * | key, | ||
... | |||
) |
Gets a dict. It ensures its a dict. Recursively until NULL.
void onion_dict_set_flags | ( | onion_dict * | dict, |
int | flags | ||
) |
onion_block* onion_dict_to_json | ( | onion_dict * | dict | ) |
Converts a dict into a JSON onion_block.
void onion_dict_unlock | ( | onion_dict * | dict | ) |
Unlocks last lock.