* Copyright Alexander Graf
*
* Authors:
*
* 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.
bool omit_comma;
};
+#define QJSON(obj) OBJECT_CHECK(QJSON, (obj), TYPE_QJSON)
+
static void json_emit_element(QJSON *json, const char *name)
{
/* Check whether we need to print a , before an element */
QJSON *qjson_new(void)
{
- QJSON *json = (QJSON *)object_new(TYPE_QJSON);
+ QJSON *json = QJSON(object_new(TYPE_QJSON));
return json;
}
static void qjson_initfn(Object *obj)
{
- QJSON *json = (QJSON *)object_dynamic_cast(obj, TYPE_QJSON);
- assert(json);
+ QJSON *json = QJSON(obj);
json->str = qstring_from_str("{ ");
json->omit_comma = true;
static void qjson_finalizefn(Object *obj)
{
- QJSON *json = (QJSON *)object_dynamic_cast(obj, TYPE_QJSON);
+ QJSON *json = QJSON(obj);
- assert(json);
qobject_decref(QOBJECT(json->str));
}