From 0b624384cd52be20e61284551d832b499d7b7707 Mon Sep 17 00:00:00 2001 From: Jonathan McCrohan Date: Sat, 14 Apr 2012 12:56:48 +0100 Subject: Imported Upstream version 2.1.8.20120216 --- dict/pdict.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 dict/pdict.h (limited to 'dict/pdict.h') diff --git a/dict/pdict.h b/dict/pdict.h new file mode 100644 index 0000000..bdd8065 --- /dev/null +++ b/dict/pdict.h @@ -0,0 +1,70 @@ +#ifndef _PDICT_H_ +#define _PDICT_H_ + +typedef enum { + PDR_VALUE_CHANGED = 1, + PDR_ENTRY_ADDED, + PDR_ENTRY_REMOVING, + PDR_CURRENT_VALUE +} pdict_reason_t; + +/* The _t stands for typedef? */ +typedef struct pdict pdict_t; + +typedef void (*pdl_notify_func_t)(const char *k, + const char *v, + pdict_reason_t r, + const char *pde_oldval, + void *arg); + +typedef int (*pdict_walk_func_t)(const char *k, + const char *v, + void *arg); + +pdict_t *pdict_alloc(void); + +int pdict_add(pdict_t *pd, + const char *k, + const char *v, + const char **ovp); + +int pdict_add_persistent_change_listener(pdict_t *pd, + const char *kpat, + pdl_notify_func_t, + void *); + +int pdict_walk(pdict_t *pd, + pdict_walk_func_t, + void *arg); + +/* + * Return whether a given key is in the dictionary. If v is set, it + * will be set to point to a copy of the value, which must be freed by + * the caller. + */ +int pdict_ent_lookup(pdict_t *pd, + const char *k, + const char **v); + +int pdict_ent_add_change_listener(pdict_t *pd, + const char *k, + pdl_notify_func_t, + void *); + +int pdict_ent_remove_change_listener(pdict_t *pd, + const char *k, + pdl_notify_func_t, + void *); + +int pdict_remove_persistent_change_listener(pdict_t *pd, + int id); + +int pdict_ent_remove(pdict_t *pd, + const char *k, + char **ovp); + +const char *pdict_reason_str(pdict_reason_t); + +pdict_reason_t pdict_reason_from_str(const char *); + +#endif -- cgit v1.2.3