qapi: Add qobject_is_equal()

This generic function (along with its implementations for different
types) determines whether two QObjects are equal.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20171114180128.17076-4-mreitz@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
Max Reitz 2017-11-14 19:01:25 +01:00
parent 254bf807e5
commit b38dd678a2
14 changed files with 186 additions and 0 deletions

View file

@ -51,6 +51,14 @@ QBool *qobject_to_qbool(const QObject *obj)
return container_of(obj, QBool, base);
}
/**
* qbool_is_equal(): Test whether the two QBools are equal
*/
bool qbool_is_equal(const QObject *x, const QObject *y)
{
return qobject_to_qbool(x)->value == qobject_to_qbool(y)->value;
}
/**
* qbool_destroy_obj(): Free all memory allocated by a
* QBool object