summaryrefslogtreecommitdiff
path: root/qdict.h
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2010-06-07 16:07:29 -0300
committerLuiz Capitulino <lcapitulino@redhat.com>2010-07-01 14:27:13 -0300
commit245141b831f1141fb54986864e5fd553bc876c82 (patch)
tree765bea2ee1cbe966fedcf962e00e48aedf343d19 /qdict.h
parentbf29023acec57f8ef1b0485b07c3e5e3dbafca84 (diff)
downloadqemu-245141b831f1141fb54986864e5fd553bc876c82.tar.gz
qemu-245141b831f1141fb54986864e5fd553bc876c82.tar.bz2
qemu-245141b831f1141fb54986864e5fd553bc876c82.zip
QDict: Introduce new iteration API
It's composed of functions qdict_first() and qdict_next(), plus functions to access QDictEntry values. This API was suggested by Markus Armbruster <armbru@redhat.com> and it offers full control over the iteration process. The usage is simple, the following example prints all keys in 'qdict' (it's hopefully better than any English description): QDict *qdict; const QDictEntry *ent; [...] for (ent = qdict_first(qdict); ent; ent = qdict_next(qdict, ent)) { printf("%s ", qdict_entry_key(ent)); } Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'qdict.h')
-rw-r--r--qdict.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/qdict.h b/qdict.h
index 0c8de3c9c2..0e7a43fcb9 100644
--- a/qdict.h
+++ b/qdict.h
@@ -45,6 +45,8 @@ QDict *qobject_to_qdict(const QObject *obj);
void qdict_iter(const QDict *qdict,
void (*iter)(const char *key, QObject *obj, void *opaque),
void *opaque);
+const QDictEntry *qdict_first(const QDict *qdict);
+const QDictEntry *qdict_next(const QDict *qdict, const QDictEntry *entry);
/* Helper to qdict_put_obj(), accepts any object */
#define qdict_put(qdict, key, obj) \