libusual
0.1
|
Minimal dict. More...
Typedefs | |
typedef bool(* | mdict_walker_f )(void *arg, const struct MBuf *k, const struct MBuf *v) |
Signature for walker callback. | |
Functions | |
struct MDict * | mdict_new (CxMem *cx) |
Create new emtpy dict. | |
void | mdict_free (struct MDict *dict) |
Free dict. | |
struct MBuf * | mdict_get_buf (struct MDict *dict, const char *key, unsigned klen) |
Get value as MBuf from string. | |
const char * | mdict_get_str (struct MDict *dict, const char *key, unsigned klen) |
Get value from dict. | |
bool | mdict_put_str (struct MDict *dict, const char *key, unsigned klen, const char *val, unsigned vlen) |
Put string to dict. | |
bool | mdict_del_key (struct MDict *dict, const char *key, unsigned klen) |
Remove a key from dict. | |
bool | mdict_walk (struct MDict *dict, mdict_walker_f cb_func, void *cb_arg) |
Walk over dict. | |
static const char * | mdict_get (struct MDict *dict, const char *key) |
Get value from dict. | |
static bool | mdict_put (struct MDict *dict, const char *key, const char *val) |
Put zero-terminated key and value to dict. | |
static bool | mdict_put_buf (struct MDict *dict, const char *key, const struct MBuf *buf) |
Put MBuf to dict. | |
static bool | mdict_del (struct MDict *dict, const char *key) |
Remove value from dict. | |
bool | mdict_urldecode (struct MDict *dict, const char *str, unsigned len) |
Urldecode string and add keys with values to dict. | |
bool | mdict_urlencode (struct MDict *dict, struct MBuf *dst) |
Urlencode dict to string. |
Minimal dict.
typedef bool(* mdict_walker_f)(void *arg, const struct MBuf *k, const struct MBuf *v) |
Signature for walker callback.
void mdict_free | ( | struct MDict * | dict | ) |
Free dict.
struct MBuf* mdict_get_buf | ( | struct MDict * | dict, |
const char * | key, | ||
unsigned | klen | ||
) | [read] |
Get value as MBuf from string.
const char* mdict_get_str | ( | struct MDict * | dict, |
const char * | key, | ||
unsigned | klen | ||
) |
Get value from dict.
Referenced by mdict_get().
bool mdict_put_str | ( | struct MDict * | dict, |
const char * | key, | ||
unsigned | klen, | ||
const char * | val, | ||
unsigned | vlen | ||
) |
Put string to dict.
Referenced by mdict_put(), and mdict_put_buf().
bool mdict_del_key | ( | struct MDict * | dict, |
const char * | key, | ||
unsigned | klen | ||
) |
Remove a key from dict.
Referenced by mdict_del().
bool mdict_walk | ( | struct MDict * | dict, |
mdict_walker_f | cb_func, | ||
void * | cb_arg | ||
) |
Walk over dict.
static const char* mdict_get | ( | struct MDict * | dict, |
const char * | key | ||
) | [inline, static] |
Get value from dict.
References mdict_get_str().
static bool mdict_put | ( | struct MDict * | dict, |
const char * | key, | ||
const char * | val | ||
) | [inline, static] |
Put zero-terminated key and value to dict.
References mdict_put_str().
static bool mdict_put_buf | ( | struct MDict * | dict, |
const char * | key, | ||
const struct MBuf * | buf | ||
) | [inline, static] |
Put MBuf to dict.
References mbuf_data(), mbuf_written(), and mdict_put_str().
static bool mdict_del | ( | struct MDict * | dict, |
const char * | key | ||
) | [inline, static] |
Remove value from dict.
References mdict_del_key().
bool mdict_urldecode | ( | struct MDict * | dict, |
const char * | str, | ||
unsigned | len | ||
) |
Urldecode string and add keys with values to dict.
bool mdict_urlencode | ( | struct MDict * | dict, |
struct MBuf * | dst | ||
) |
Urlencode dict to string.