qemu-e2k/qobject
Marc-André Lureau 3d3eacaecc qobject: use a QObjectBase_ struct
By moving the base fields to a QObjectBase_, QObject can be a type
which also has a 'base' field. This allows writing a generic QOBJECT()
macro that will work with any QObject type, including QObject
itself. The container_of() macro ensures that the object to cast has a
QObjectBase_ base field, giving some type safety guarantees. QObject
must have no members but QObjectBase_ base, or else QOBJECT() breaks.

QObjectBase_ is not a typedef and uses a trailing underscore to make
it obvious it is not for normal use and to avoid potential abuse.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20180419150145.24795-3-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-05-04 08:27:53 +02:00
..
Makefile.objs qlit: move qlit from check-qjson to qobject/ 2017-09-04 13:09:11 +02:00
json-lexer.c json: learn to parse uint64 numbers 2017-06-20 14:31:31 +02:00
json-parser.c qapi: Make more of qobject_to() 2018-03-19 14:58:36 -05:00
json-streamer.c json-streamer: fix double-free on exiting during a parse 2016-07-12 18:31:27 +02:00
qbool.c qapi: Remove qobject_to_X() functions 2018-03-19 14:58:36 -05:00
qdict.c qapi: Make more of qobject_to() 2018-03-19 14:58:36 -05:00
qjson.c qapi: Replace qobject_to_X(o) by qobject_to(X, o) 2018-03-19 14:58:36 -05:00
qlist.c qapi: Remove qobject_to_X() functions 2018-03-19 14:58:36 -05:00
qlit.c qapi: Replace qobject_to_X(o) by qobject_to(X, o) 2018-03-19 14:58:36 -05:00
qnull.c qapi: Add qobject_is_equal() 2017-11-17 18:21:30 +01:00
qnum.c qapi: Remove qobject_to_X() functions 2018-03-19 14:58:36 -05:00
qobject.c qobject: use a QObjectBase_ struct 2018-05-04 08:27:53 +02:00
qstring.c qobject: introduce qobject_get_try_str() 2018-03-19 14:58:36 -05:00