mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 06:43:53 -06:00
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:
parent
254bf807e5
commit
b38dd678a2
14 changed files with 186 additions and 0 deletions
|
@ -24,6 +24,7 @@ typedef struct QBool {
|
|||
QBool *qbool_from_bool(bool value);
|
||||
bool qbool_get_bool(const QBool *qb);
|
||||
QBool *qobject_to_qbool(const QObject *obj);
|
||||
bool qbool_is_equal(const QObject *x, const QObject *y);
|
||||
void qbool_destroy_obj(QObject *obj);
|
||||
|
||||
#endif /* QBOOL_H */
|
||||
|
|
|
@ -43,6 +43,7 @@ void qdict_del(QDict *qdict, const char *key);
|
|||
int qdict_haskey(const QDict *qdict, const char *key);
|
||||
QObject *qdict_get(const QDict *qdict, const char *key);
|
||||
QDict *qobject_to_qdict(const QObject *obj);
|
||||
bool qdict_is_equal(const QObject *x, const QObject *y);
|
||||
void qdict_iter(const QDict *qdict,
|
||||
void (*iter)(const char *key, QObject *obj, void *opaque),
|
||||
void *opaque);
|
||||
|
|
|
@ -61,6 +61,7 @@ QObject *qlist_peek(QList *qlist);
|
|||
int qlist_empty(const QList *qlist);
|
||||
size_t qlist_size(const QList *qlist);
|
||||
QList *qobject_to_qlist(const QObject *obj);
|
||||
bool qlist_is_equal(const QObject *x, const QObject *y);
|
||||
void qlist_destroy_obj(QObject *obj);
|
||||
|
||||
static inline const QListEntry *qlist_first(const QList *qlist)
|
||||
|
|
|
@ -27,4 +27,6 @@ static inline QNull *qnull(void)
|
|||
return &qnull_;
|
||||
}
|
||||
|
||||
bool qnull_is_equal(const QObject *x, const QObject *y);
|
||||
|
||||
#endif /* QNULL_H */
|
||||
|
|
|
@ -69,6 +69,7 @@ double qnum_get_double(QNum *qn);
|
|||
char *qnum_to_string(QNum *qn);
|
||||
|
||||
QNum *qobject_to_qnum(const QObject *obj);
|
||||
bool qnum_is_equal(const QObject *x, const QObject *y);
|
||||
void qnum_destroy_obj(QObject *obj);
|
||||
|
||||
#endif /* QNUM_H */
|
||||
|
|
|
@ -67,6 +67,15 @@ static inline void qobject_incref(QObject *obj)
|
|||
obj->refcnt++;
|
||||
}
|
||||
|
||||
/**
|
||||
* qobject_is_equal(): Return whether the two objects are equal.
|
||||
*
|
||||
* Any of the pointers may be NULL; return true if both are. Always
|
||||
* return false if only one is (therefore a QNull object is not
|
||||
* considered equal to a NULL pointer).
|
||||
*/
|
||||
bool qobject_is_equal(const QObject *x, const QObject *y);
|
||||
|
||||
/**
|
||||
* qobject_destroy(): Free resources used by the object
|
||||
*/
|
||||
|
|
|
@ -31,6 +31,7 @@ void qstring_append_int(QString *qstring, int64_t value);
|
|||
void qstring_append(QString *qstring, const char *str);
|
||||
void qstring_append_chr(QString *qstring, int c);
|
||||
QString *qobject_to_qstring(const QObject *obj);
|
||||
bool qstring_is_equal(const QObject *x, const QObject *y);
|
||||
void qstring_destroy_obj(QObject *obj);
|
||||
|
||||
#endif /* QSTRING_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue