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