Merge remote-tracking branch 'remotes/awilliam/tags/vfio-fixes-20190702.0' into staging
[qemu/ar7.git] / include / qapi / qmp / qlit.h
blobc0676d5daf20cd132be679fe84b8484518fc6cd1
1 /*
2 * Copyright IBM, Corp. 2009
3 * Copyright (c) 2013, 2015, 2017 Red Hat Inc.
5 * Authors:
6 * Anthony Liguori <aliguori@us.ibm.com>
7 * Markus Armbruster <armbru@redhat.com>
8 * Marc-André Lureau <marcandre.lureau@redhat.com>
10 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
11 * See the COPYING.LIB file in the top-level directory.
14 #ifndef QLIT_H
15 #define QLIT_H
17 #include "qobject.h"
19 typedef struct QLitDictEntry QLitDictEntry;
20 typedef struct QLitObject QLitObject;
22 struct QLitObject {
23 QType type;
24 union {
25 bool qbool;
26 int64_t qnum;
27 const char *qstr;
28 QLitDictEntry *qdict;
29 QLitObject *qlist;
30 } value;
33 struct QLitDictEntry {
34 const char *key;
35 QLitObject value;
38 #define QLIT_QNULL \
39 { .type = QTYPE_QNULL }
40 #define QLIT_QBOOL(val) \
41 { .type = QTYPE_QBOOL, .value.qbool = (val) }
42 #define QLIT_QNUM(val) \
43 { .type = QTYPE_QNUM, .value.qnum = (val) }
44 #define QLIT_QSTR(val) \
45 { .type = QTYPE_QSTRING, .value.qstr = (val) }
46 #define QLIT_QDICT(val) \
47 { .type = QTYPE_QDICT, .value.qdict = (val) }
48 #define QLIT_QLIST(val) \
49 { .type = QTYPE_QLIST, .value.qlist = (val) }
51 bool qlit_equal_qobject(const QLitObject *lhs, const QObject *rhs);
53 QObject *qobject_from_qlit(const QLitObject *qlit);
55 #endif /* QLIT_H */