tcg arm/mips/ia64: add a comment about retranslation and caches
[qemu.git] / qdict.h
blob929d8d22f50bde2370d89060b29fb083a548d814
1 /*
2 * QDict Module
4 * Copyright (C) 2009 Red Hat Inc.
6 * Authors:
7 * Luiz Capitulino <lcapitulino@redhat.com>
9 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
10 * See the COPYING.LIB file in the top-level directory.
13 #ifndef QDICT_H
14 #define QDICT_H
16 #include "qobject.h"
17 #include "qlist.h"
18 #include "qemu-queue.h"
19 #include <stdint.h>
21 #define QDICT_BUCKET_MAX 512
23 typedef struct QDictEntry {
24 char *key;
25 QObject *value;
26 QLIST_ENTRY(QDictEntry) next;
27 } QDictEntry;
29 typedef struct QDict {
30 QObject_HEAD;
31 size_t size;
32 QLIST_HEAD(,QDictEntry) table[QDICT_BUCKET_MAX];
33 } QDict;
35 /* Object API */
36 QDict *qdict_new(void);
37 const char *qdict_entry_key(const QDictEntry *entry);
38 QObject *qdict_entry_value(const QDictEntry *entry);
39 size_t qdict_size(const QDict *qdict);
40 void qdict_put_obj(QDict *qdict, const char *key, QObject *value);
41 void qdict_del(QDict *qdict, const char *key);
42 int qdict_haskey(const QDict *qdict, const char *key);
43 QObject *qdict_get(const QDict *qdict, const char *key);
44 QDict *qobject_to_qdict(const QObject *obj);
45 void qdict_iter(const QDict *qdict,
46 void (*iter)(const char *key, QObject *obj, void *opaque),
47 void *opaque);
48 const QDictEntry *qdict_first(const QDict *qdict);
49 const QDictEntry *qdict_next(const QDict *qdict, const QDictEntry *entry);
51 /* Helper to qdict_put_obj(), accepts any object */
52 #define qdict_put(qdict, key, obj) \
53 qdict_put_obj(qdict, key, QOBJECT(obj))
55 /* High level helpers */
56 double qdict_get_double(const QDict *qdict, const char *key);
57 int64_t qdict_get_int(const QDict *qdict, const char *key);
58 int qdict_get_bool(const QDict *qdict, const char *key);
59 QList *qdict_get_qlist(const QDict *qdict, const char *key);
60 QDict *qdict_get_qdict(const QDict *qdict, const char *key);
61 const char *qdict_get_str(const QDict *qdict, const char *key);
62 int64_t qdict_get_try_int(const QDict *qdict, const char *key,
63 int64_t def_value);
64 int qdict_get_try_bool(const QDict *qdict, const char *key, int def_value);
65 const char *qdict_get_try_str(const QDict *qdict, const char *key);
67 #endif /* QDICT_H */