| mowgli_dictionary.h | | mowgli_dictionary.h | |
| | | | |
| skipping to change at line 66 | | skipping to change at line 66 | |
| /* | | /* | |
| * this is a convenience macro for inlining iteration of dictionaries. | | * this is a convenience macro for inlining iteration of dictionaries. | |
| */ | | */ | |
| #define MOWGLI_DICTIONARY_FOREACH(element, state, dict) for (mowgli_diction
ary_foreach_start((dict), (state)); (element = mowgli_dictionary_foreach_cu
r((dict), (state))); mowgli_dictionary_foreach_next((dict), (state))) | | #define MOWGLI_DICTIONARY_FOREACH(element, state, dict) for (mowgli_diction
ary_foreach_start((dict), (state)); (element = mowgli_dictionary_foreach_cu
r((dict), (state))); mowgli_dictionary_foreach_next((dict), (state))) | |
| | | | |
| /* | | /* | |
| * mowgli_dictionary_create() creates a new dictionary tree. | | * mowgli_dictionary_create() creates a new dictionary tree. | |
| * compare_cb is the comparison function, typically strcmp, strcasecmp or | | * compare_cb is the comparison function, typically strcmp, strcasecmp or | |
| * irccasecmp. | | * irccasecmp. | |
| */ | | */ | |
|
| extern mowgli_dictionary_t *mowgli_dictionary_create(mowgli_dictionary_comp
arator_func_t compare_cb); | | extern mowgli_dictionary_t *mowgli_dictionary_create(mowgli_dictionary_comp
arator_func_t compare_cb) MOWGLI_DEPRECATED; | |
| | | | |
| /* | | /* | |
| * mowgli_dictionary_create_named() creates a new dictionary tree which has
a name. | | * mowgli_dictionary_create_named() creates a new dictionary tree which has
a name. | |
| * name is the name, compare_cb is the comparator. | | * name is the name, compare_cb is the comparator. | |
| */ | | */ | |
|
| extern mowgli_dictionary_t *mowgli_dictionary_create_named(const char *name
, mowgli_dictionary_comparator_func_t compare_cb); | | extern mowgli_dictionary_t *mowgli_dictionary_create_named(const char *name
, mowgli_dictionary_comparator_func_t compare_cb) MOWGLI_DEPRECATED; | |
| | | | |
| /* | | /* | |
| * mowgli_dictionary_set_comparator_func() resets the comparator used for l
ookups and | | * mowgli_dictionary_set_comparator_func() resets the comparator used for l
ookups and | |
| * insertions in the DTree structure. | | * insertions in the DTree structure. | |
| */ | | */ | |
| extern void mowgli_dictionary_set_comparator_func(mowgli_dictionary_t *dict
, | | extern void mowgli_dictionary_set_comparator_func(mowgli_dictionary_t *dict
, | |
|
| mowgli_dictionary_comparator_func_t compare_cb); | | mowgli_dictionary_comparator_func_t compare_cb) MOWGLI_DEPRECATED; | |
| | | | |
| /* | | /* | |
| * mowgli_dictionary_get_comparator_func() returns the comparator used for
lookups and | | * mowgli_dictionary_get_comparator_func() returns the comparator used for
lookups and | |
| * insertions in the DTree structure. | | * insertions in the DTree structure. | |
| */ | | */ | |
|
| extern mowgli_dictionary_comparator_func_t mowgli_dictionary_get_comparator
_func(mowgli_dictionary_t *dict); | | extern mowgli_dictionary_comparator_func_t mowgli_dictionary_get_comparator
_func(mowgli_dictionary_t *dict) MOWGLI_DEPRECATED; | |
| | | | |
| /* | | /* | |
| * mowgli_dictionary_get_linear_index() returns the linear index of an obje
ct in the | | * mowgli_dictionary_get_linear_index() returns the linear index of an obje
ct in the | |
| * DTree structure. | | * DTree structure. | |
| */ | | */ | |
|
| extern int mowgli_dictionary_get_linear_index(mowgli_dictionary_t *dict, co
nst char *key); | | extern int mowgli_dictionary_get_linear_index(mowgli_dictionary_t *dict, co
nst char *key) MOWGLI_DEPRECATED; | |
| | | | |
| /* | | /* | |
| * mowgli_dictionary_destroy() destroys all entries in a dtree, and also op
tionally calls | | * mowgli_dictionary_destroy() destroys all entries in a dtree, and also op
tionally calls | |
| * a defined callback function to destroy any data attached to it. | | * a defined callback function to destroy any data attached to it. | |
| */ | | */ | |
| extern void mowgli_dictionary_destroy(mowgli_dictionary_t *dtree, | | extern void mowgli_dictionary_destroy(mowgli_dictionary_t *dtree, | |
| void (*destroy_cb)(mowgli_dictionary_elem_t *delem, void *privdata), | | void (*destroy_cb)(mowgli_dictionary_elem_t *delem, void *privdata), | |
|
| void *privdata); | | void *privdata) MOWGLI_DEPRECATED; | |
| | | | |
| /* | | /* | |
| * mowgli_dictionary_foreach() iterates all entries in a dtree, and also op
tionally calls | | * mowgli_dictionary_foreach() iterates all entries in a dtree, and also op
tionally calls | |
| * a defined callback function to use any data attached to it. | | * a defined callback function to use any data attached to it. | |
| * | | * | |
| * To shortcircuit iteration, return non-zero from the callback function. | | * To shortcircuit iteration, return non-zero from the callback function. | |
| */ | | */ | |
| extern void mowgli_dictionary_foreach(mowgli_dictionary_t *dtree, | | extern void mowgli_dictionary_foreach(mowgli_dictionary_t *dtree, | |
| int (*foreach_cb)(mowgli_dictionary_elem_t *delem, void *privdata), | | int (*foreach_cb)(mowgli_dictionary_elem_t *delem, void *privdata), | |
|
| void *privdata); | | void *privdata) MOWGLI_DEPRECATED; | |
| | | | |
| /* | | /* | |
| * mowgli_dictionary_search() iterates all entries in a dtree, and also opt
ionally calls | | * mowgli_dictionary_search() iterates all entries in a dtree, and also opt
ionally calls | |
| * a defined callback function to use any data attached to it. | | * a defined callback function to use any data attached to it. | |
| * | | * | |
| * When the object is found, a non-NULL is returned from the callback, whic
h results | | * When the object is found, a non-NULL is returned from the callback, whic
h results | |
| * in that object being returned to the user. | | * in that object being returned to the user. | |
| */ | | */ | |
| extern void *mowgli_dictionary_search(mowgli_dictionary_t *dtree, | | extern void *mowgli_dictionary_search(mowgli_dictionary_t *dtree, | |
| void *(*foreach_cb)(mowgli_dictionary_elem_t *delem, void *privdata)
, | | void *(*foreach_cb)(mowgli_dictionary_elem_t *delem, void *privdata)
, | |
|
| void *privdata); | | void *privdata) MOWGLI_DEPRECATED; | |
| | | | |
| /* | | /* | |
| * mowgli_dictionary_foreach_start() begins an iteration over all items | | * mowgli_dictionary_foreach_start() begins an iteration over all items | |
| * keeping state in the given struct. If there is only one iteration | | * keeping state in the given struct. If there is only one iteration | |
| * in progress at a time, it is permitted to remove the current element | | * in progress at a time, it is permitted to remove the current element | |
| * of the iteration (but not any other element). | | * of the iteration (but not any other element). | |
| */ | | */ | |
| extern void mowgli_dictionary_foreach_start(mowgli_dictionary_t *dtree, | | extern void mowgli_dictionary_foreach_start(mowgli_dictionary_t *dtree, | |
|
| mowgli_dictionary_iteration_state_t *state); | | mowgli_dictionary_iteration_state_t *state) MOWGLI_DEPRECATED; | |
| | | | |
| /* | | /* | |
| * mowgli_dictionary_foreach_cur() returns the current element of the itera
tion, | | * mowgli_dictionary_foreach_cur() returns the current element of the itera
tion, | |
| * or NULL if there are no more elements. | | * or NULL if there are no more elements. | |
| */ | | */ | |
| extern void *mowgli_dictionary_foreach_cur(mowgli_dictionary_t *dtree, | | extern void *mowgli_dictionary_foreach_cur(mowgli_dictionary_t *dtree, | |
|
| mowgli_dictionary_iteration_state_t *state); | | mowgli_dictionary_iteration_state_t *state) MOWGLI_DEPRECATED; | |
| | | | |
| /* | | /* | |
| * mowgli_dictionary_foreach_next() moves to the next element. | | * mowgli_dictionary_foreach_next() moves to the next element. | |
| */ | | */ | |
| extern void mowgli_dictionary_foreach_next(mowgli_dictionary_t *dtree, | | extern void mowgli_dictionary_foreach_next(mowgli_dictionary_t *dtree, | |
|
| mowgli_dictionary_iteration_state_t *state); | | mowgli_dictionary_iteration_state_t *state) MOWGLI_DEPRECATED; | |
| | | | |
| /* | | /* | |
| * mowgli_dictionary_add() adds a key->value entry to the dictionary tree. | | * mowgli_dictionary_add() adds a key->value entry to the dictionary tree. | |
| */ | | */ | |
|
| extern mowgli_dictionary_elem_t *mowgli_dictionary_add(mowgli_dictionary_t
*dtree, const char *key, void *data); | | extern mowgli_dictionary_elem_t *mowgli_dictionary_add(mowgli_dictionary_t
*dtree, const char *key, void *data) MOWGLI_DEPRECATED; | |
| | | | |
| /* | | /* | |
| * mowgli_dictionary_find() returns a mowgli_dictionary_elem_t container fr
om a dtree for key 'key'. | | * mowgli_dictionary_find() returns a mowgli_dictionary_elem_t container fr
om a dtree for key 'key'. | |
| */ | | */ | |
|
| extern mowgli_dictionary_elem_t *mowgli_dictionary_find(mowgli_dictionary_t
*dtree, const char *key); | | extern mowgli_dictionary_elem_t *mowgli_dictionary_find(mowgli_dictionary_t
*dtree, const char *key) MOWGLI_DEPRECATED; | |
| | | | |
| /* | | /* | |
| * mowgli_dictionary_find() returns data from a dtree for key 'key'. | | * mowgli_dictionary_find() returns data from a dtree for key 'key'. | |
| */ | | */ | |
|
| extern void *mowgli_dictionary_retrieve(mowgli_dictionary_t *dtree, const c
har *key); | | extern void *mowgli_dictionary_retrieve(mowgli_dictionary_t *dtree, const c
har *key) MOWGLI_DEPRECATED; | |
| | | | |
| /* | | /* | |
| * mowgli_dictionary_delete() deletes a key->value entry from the dictionar
y tree. | | * mowgli_dictionary_delete() deletes a key->value entry from the dictionar
y tree. | |
| */ | | */ | |
|
| extern void *mowgli_dictionary_delete(mowgli_dictionary_t *dtree, const cha
r *key); | | extern void *mowgli_dictionary_delete(mowgli_dictionary_t *dtree, const cha
r *key) MOWGLI_DEPRECATED; | |
| | | | |
|
| void mowgli_dictionary_stats(mowgli_dictionary_t *dict, void (*cb)(const ch
ar *line, void *privdata), void *privdata); | | void mowgli_dictionary_stats(mowgli_dictionary_t *dict, void (*cb)(const ch
ar *line, void *privdata), void *privdata) MOWGLI_DEPRECATED; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 16 change blocks. |
| 16 lines changed or deleted | | 16 lines changed or added | |
|