diff options
| author | Tatiana Borisova <tatiana.borisova@qt.io> | 2024-03-18 17:12:11 +0100 |
|---|---|---|
| committer | Tatiana Borisova <tatiana.borisova@qt.io> | 2024-03-22 14:15:54 +0100 |
| commit | e2bd247081e632236ee7d32bac90cd2018691dbb (patch) | |
| tree | 80c82c03e394635da38873a87914b774c83a8cdf /src/corelib/serialization/qjsondocument.cpp | |
| parent | 043ceca40ffda0a87871e1800578c99273916e60 (diff) | |
QJsonDocument: use new comparison helper macros
Replace public operators operator==(), operator!=() of
QJsonDocument to friend methods comparesEqual().
Use QT_CORE_REMOVED_SINCE and removed_api.cpp to get rid of current
comparison methods and replace them with a friend.
Task-number: QTBUG-120300
Change-Id: I7b61765c34406b7a9fb7dd8b1fc554c87af6a3f3
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/serialization/qjsondocument.cpp')
| -rw-r--r-- | src/corelib/serialization/qjsondocument.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/corelib/serialization/qjsondocument.cpp b/src/corelib/serialization/qjsondocument.cpp index ae0197bd2a4..e2528f18dcc 100644 --- a/src/corelib/serialization/qjsondocument.cpp +++ b/src/corelib/serialization/qjsondocument.cpp @@ -30,6 +30,8 @@ QT_BEGIN_NAMESPACE \brief The QJsonDocument class provides a way to read and write JSON documents. + \compares equality + QJsonDocument is a class that wraps a complete JSON document and can read this document from, and write it to, a UTF-8 encoded text-based representation. @@ -456,20 +458,22 @@ const QJsonValue QJsonDocument::operator[](qsizetype i) const } /*! - Returns \c true if the \a other document is equal to this document. - */ -bool QJsonDocument::operator==(const QJsonDocument &other) const + \fn bool QJsonDocument::operator==(const QJsonDocument &lhs, const QJsonDocument &rhs) + + Returns \c true if the \a lhs document is equal to \a rhs document, \c false otherwise. +*/ +bool comparesEqual(const QJsonDocument &lhs, const QJsonDocument &rhs) noexcept { - if (d && other.d) - return d->value == other.d->value; - return !d == !other.d; + if (lhs.d && rhs.d) + return lhs.d->value == rhs.d->value; + return !lhs.d == !rhs.d; } /*! - \fn bool QJsonDocument::operator!=(const QJsonDocument &other) const + \fn bool QJsonDocument::operator!=(const QJsonDocument &lhs, const QJsonDocument &rhs) - returns \c true if \a other is not equal to this document - */ + Returns \c true if the \a lhs document is not equal to \a rhs document, \c false otherwise. +*/ /*! returns \c true if this document is null. |
