5 #include "qemu-queue.h"
8 #define QDICT_HASH_SIZE 512
10 typedef struct QDictEntry
{
13 QLIST_ENTRY(QDictEntry
) next
;
16 typedef struct QDict
{
19 QLIST_HEAD(,QDictEntry
) table
[QDICT_HASH_SIZE
];
23 QDict
*qdict_new(void);
24 size_t qdict_size(const QDict
*qdict
);
25 void qdict_put_obj(QDict
*qdict
, const char *key
, QObject
*value
);
26 void qdict_del(QDict
*qdict
, const char *key
);
27 int qdict_haskey(const QDict
*qdict
, const char *key
);
28 QObject
*qdict_get(const QDict
*qdict
, const char *key
);
29 QDict
*qobject_to_qdict(const QObject
*obj
);
30 void qdict_iter(const QDict
*qdict
,
31 void (*iter
)(const char *key
, QObject
*obj
, void *opaque
),
34 /* Helper to qdict_put_obj(), accepts any object */
35 #define qdict_put(qdict, key, obj) \
36 qdict_put_obj(qdict, key, QOBJECT(obj))
38 /* High level helpers */
39 int64_t qdict_get_int(const QDict
*qdict
, const char *key
);
40 const char *qdict_get_str(const QDict
*qdict
, const char *key
);
41 int64_t qdict_get_try_int(const QDict
*qdict
, const char *key
,
43 const char *qdict_get_try_str(const QDict
*qdict
, const char *key
);