diff options
Diffstat (limited to 'src/corelib/serialization/qjsondocument.cpp')
-rw-r--r-- | src/corelib/serialization/qjsondocument.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/corelib/serialization/qjsondocument.cpp b/src/corelib/serialization/qjsondocument.cpp index 1ba4b5952c..e2528f18dc 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. @@ -44,7 +46,7 @@ QT_BEGIN_NAMESPACE and isObject(). The array or object contained in the document can be retrieved using array() or object() and then read or manipulated. - \sa {JSON Support in Qt}, {JSON Save Game Example} + \sa {JSON Support in Qt}, {Saving and Loading a Game} */ @@ -181,6 +183,7 @@ QJsonDocument &QJsonDocument::operator =(const QJsonDocument &other) Swaps the document \a other with this. This operation is very fast and never fails. */ +#ifndef QT_NO_VARIANT /*! Creates a QJsonDocument from the QVariant \a variant. @@ -231,6 +234,7 @@ QVariant QJsonDocument::toVariant() const return QJsonArray(container).toVariantList(); return QJsonObject(container).toVariantMap(); } +#endif // !QT_NO_VARIANT /*! \enum QJsonDocument::JsonFormat @@ -454,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. |