2017-08-25 12:59:01 +02: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 "qobject.h"
|
|
|
|
|
2017-08-25 12:59:02 +02:00
|
|
|
typedef struct QLitDictEntry QLitDictEntry;
|
|
|
|
typedef struct QLitObject QLitObject;
|
2017-08-25 12:59:01 +02:00
|
|
|
|
2017-08-25 12:59:02 +02:00
|
|
|
struct QLitObject {
|
2018-03-05 18:29:49 +01:00
|
|
|
QType type;
|
2017-08-25 12:59:01 +02:00
|
|
|
union {
|
2017-08-25 12:59:07 +02:00
|
|
|
bool qbool;
|
2017-08-25 12:59:01 +02:00
|
|
|
int64_t qnum;
|
|
|
|
const char *qstr;
|
2017-08-25 12:59:02 +02:00
|
|
|
QLitDictEntry *qdict;
|
|
|
|
QLitObject *qlist;
|
2017-08-25 12:59:01 +02:00
|
|
|
} value;
|
|
|
|
};
|
|
|
|
|
2017-08-25 12:59:02 +02:00
|
|
|
struct QLitDictEntry {
|
2017-08-25 12:59:01 +02:00
|
|
|
const char *key;
|
2017-08-25 12:59:02 +02:00
|
|
|
QLitObject value;
|
2017-08-25 12:59:01 +02:00
|
|
|
};
|
|
|
|
|
2017-08-25 12:59:07 +02:00
|
|
|
#define QLIT_QNULL \
|
|
|
|
{ .type = QTYPE_QNULL }
|
|
|
|
#define QLIT_QBOOL(val) \
|
|
|
|
{ .type = QTYPE_QBOOL, .value.qbool = (val) }
|
2017-08-25 12:59:01 +02:00
|
|
|
#define QLIT_QNUM(val) \
|
2017-08-25 12:59:03 +02:00
|
|
|
{ .type = QTYPE_QNUM, .value.qnum = (val) }
|
2017-08-25 12:59:01 +02:00
|
|
|
#define QLIT_QSTR(val) \
|
2017-08-25 12:59:03 +02:00
|
|
|
{ .type = QTYPE_QSTRING, .value.qstr = (val) }
|
2017-08-25 12:59:01 +02:00
|
|
|
#define QLIT_QDICT(val) \
|
2017-08-25 12:59:03 +02:00
|
|
|
{ .type = QTYPE_QDICT, .value.qdict = (val) }
|
2017-08-25 12:59:01 +02:00
|
|
|
#define QLIT_QLIST(val) \
|
2017-08-25 12:59:03 +02:00
|
|
|
{ .type = QTYPE_QLIST, .value.qlist = (val) }
|
2017-08-25 12:59:01 +02:00
|
|
|
|
2017-08-25 12:59:06 +02:00
|
|
|
bool qlit_equal_qobject(const QLitObject *lhs, const QObject *rhs);
|
2017-08-25 12:59:01 +02:00
|
|
|
|
2018-03-05 18:29:50 +01:00
|
|
|
QObject *qobject_from_qlit(const QLitObject *qlit);
|
|
|
|
|
2017-08-25 12:59:01 +02:00
|
|
|
#endif /* QLIT_H */
|