unicorn/qemu/include/qapi/qmp
Max Reitz dbdba16732
qapi: Add qobject_to()
This is a dynamic casting macro that, given a QObject type, returns an
object as that type or NULL if the object is of a different type (or
NULL itself).

The macro uses lower-case letters because:
1. There does not seem to be a hard rule on whether qemu macros have to
be upper-cased,
2. The current situation in qapi/qmp is inconsistent (compare e.g.
QINCREF() vs. qdict_put()),
3. qobject_to() will evaluate its @obj parameter only once, thus it is
generally not important to the caller whether it is a macro or not,
4. I prefer it aesthetically.

The macro parameter order is chosen with typename first for
consistency with other QAPI macros like QAPI_CLONE(), as well as
for legibility (read it as "qobject to" type "applied to" obj).

Backports commit 1a56b1e2ab5e9d6d89386ca953b4afb419e15abe from qemu
2018-03-20 10:45:59 -04:00
..
qbool.h qapi: Add qobject_is_equal() 2018-03-08 08:41:43 -05:00
qdict.h qdict: Introduce qdict_rename_keys() 2018-03-12 10:11:48 -04:00
qerror.h qmp: Eliminate silly QERR_QMP_* macros 2018-03-02 11:28:17 -05:00
qjson.h import 2015-08-21 15:04:50 +08:00
qlist.h qapi: Add qobject_is_equal() 2018-03-08 08:41:43 -05:00
qlit.h qlit: add qobject_from_qlit() 2018-03-20 10:30:41 -04:00
qnull.h qapi: Add qobject_is_equal() 2018-03-08 08:41:43 -05:00
qnum.h qapi: Add qobject_is_equal() 2018-03-08 08:41:43 -05:00
qobject.h qapi: Add qobject_to() 2018-03-20 10:45:59 -04:00
qstring.h qapi: Add qobject_is_equal() 2018-03-08 08:41:43 -05:00