2018-03-07 22:03:34 +00:00
|
|
|
/*
|
|
|
|
* Copyright IBM, Corp. 2009
|
|
|
|
* Copyright (c) 2013, 2015, 2017 Red Hat Inc.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Anthony Liguori <aliguori@us.ibm.com>
|
|
|
|
* Markus Armbruster <armbru@redhat.com>
|
|
|
|
* Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
|
|
|
* See the COPYING.LIB file in the top-level directory.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#ifndef QLIT_H
|
|
|
|
#define QLIT_H
|
|
|
|
|
|
|
|
#include "qapi-types.h"
|
|
|
|
#include "qobject.h"
|
|
|
|
|
2018-03-07 22:10:21 +00:00
|
|
|
typedef struct QLitDictEntry QLitDictEntry;
|
|
|
|
typedef struct QLitObject QLitObject;
|
2018-03-07 22:03:34 +00:00
|
|
|
|
2018-03-07 22:10:21 +00:00
|
|
|
struct QLitObject {
|
2018-03-07 22:03:34 +00:00
|
|
|
int type;
|
|
|
|
union {
|
2018-03-07 22:18:08 +00:00
|
|
|
bool qbool;
|
2018-03-07 22:03:34 +00:00
|
|
|
int64_t qnum;
|
|
|
|
const char *qstr;
|
2018-03-07 22:10:21 +00:00
|
|
|
QLitDictEntry *qdict;
|
|
|
|
QLitObject *qlist;
|
2018-03-07 22:03:34 +00:00
|
|
|
} value;
|
|
|
|
};
|
|
|
|
|
2018-03-07 22:10:21 +00:00
|
|
|
struct QLitDictEntry {
|
2018-03-07 22:03:34 +00:00
|
|
|
const char *key;
|
2018-03-07 22:10:21 +00:00
|
|
|
QLitObject value;
|
2018-03-07 22:03:34 +00:00
|
|
|
};
|
|
|
|
|
2018-03-07 22:18:08 +00:00
|
|
|
#define QLIT_QNULL \
|
|
|
|
{ .type = QTYPE_QNULL }
|
|
|
|
#define QLIT_QBOOL(val) \
|
|
|
|
{ .type = QTYPE_QBOOL, .value.qbool = (val) }
|
2018-03-07 22:03:34 +00:00
|
|
|
#define QLIT_QNUM(val) \
|
2018-03-07 22:13:12 +00:00
|
|
|
{ .type = QTYPE_QNUM, .value.qnum = (val) }
|
2018-03-07 22:03:34 +00:00
|
|
|
#define QLIT_QSTR(val) \
|
2018-03-07 22:13:12 +00:00
|
|
|
{ .type = QTYPE_QSTRING, .value.qstr = (val) }
|
2018-03-07 22:03:34 +00:00
|
|
|
#define QLIT_QDICT(val) \
|
2018-03-07 22:13:12 +00:00
|
|
|
{ .type = QTYPE_QDICT, .value.qdict = (val) }
|
2018-03-07 22:03:34 +00:00
|
|
|
#define QLIT_QLIST(val) \
|
2018-03-07 22:13:12 +00:00
|
|
|
{ .type = QTYPE_QLIST, .value.qlist = (val) }
|
2018-03-07 22:03:34 +00:00
|
|
|
|
2018-03-07 22:17:36 +00:00
|
|
|
bool qlit_equal_qobject(const QLitObject *lhs, const QObject *rhs);
|
2018-03-07 22:03:34 +00:00
|
|
|
|
|
|
|
#endif /* QLIT_H */
|