dict.c revision 9844b5359f5cab77e4c31a7ac9e4a60a0073929e
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen/* Copyright (C) 2005 Timo Sirainen */
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainenstatic array_t ARRAY_DEFINE(dict_classes, struct dict *);
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainenstatic struct dict *dict_class_lookup(const char *name)
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen unsigned int i, count;
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen for (i = 0; i < count; i++) {
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainenvoid dict_class_register(struct dict *dict_class)
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen ARRAY_CREATE(&dict_classes, default_pool, struct dict *, 8);
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen if (dict_class_lookup(dict_class->name) != NULL) {
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen i_fatal("dict_class_register(%s): Already registered",
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainenvoid dict_class_unregister(struct dict *dict_class)
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen unsigned int i, count;
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen for (i = 0; i < count; i++) {
9844b5359f5cab77e4c31a7ac9e4a60a0073929eTimo Sirainenstruct dict *dict_init(const char *uri, const char *username)
9844b5359f5cab77e4c31a7ac9e4a60a0073929eTimo Sirainen const char *p, *name;
f8ead0942a9b7c8fcf91414ed1b534d5807ca555Timo Sirainenint dict_lookup(struct dict *dict, pool_t pool, const char *key,
f8ead0942a9b7c8fcf91414ed1b534d5807ca555Timo Sirainen const char **value_r)
f8ead0942a9b7c8fcf91414ed1b534d5807ca555Timo Sirainen return dict->v.lookup(dict, pool, key, value_r);
6ef7e31619edfaa17ed044b45861d106a86191efTimo Sirainendict_iterate_init(struct dict *dict, const char *path, bool recurse)
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen return dict->v.iterate_init(dict, path, recurse);
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainenint dict_iterate(struct dict_iterate_context *ctx,
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainen return ctx->dict->v.iterate(ctx, key_r, value_r);
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainenvoid dict_iterate_deinit(struct dict_iterate_context *ctx)
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainenstruct dict_transaction_context *dict_transaction_begin(struct dict *dict)
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainenint dict_transaction_commit(struct dict_transaction_context *ctx)
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainenvoid dict_transaction_rollback(struct dict_transaction_context *ctx)
28c75d59f1d1a7caeb85635964f3881c0038eb23Timo Sirainenvoid dict_set(struct dict_transaction_context *ctx,