diff options
| author | Rym Bouabid <rym.bouabid@qt.io> | 2024-02-14 16:15:19 +0100 |
|---|---|---|
| committer | Rym Bouabid <rym.bouabid@qt.io> | 2024-02-23 19:46:02 +0100 |
| commit | cd67684c89ab6e8b951778c317d459124e6d9c5d (patch) | |
| tree | 5359934955503ec164009cf2edee22418344c61f /src/corelib/io/qurlquery.cpp | |
| parent | ddcbf02d2004baab53c88a5661b5350942ebff75 (diff) | |
QUrlQuery: Use new comparison helper macros
QUrlQuery had operator==() and operator!=() defined as public member
functions, so use QT_CORE_REMOVED_SINCE and removed_api.cpp to get
rid of these methods and replace them with a hidden friend.
Use QT_TEST_ALL_EQUALITY_OPS macro in unit-tests.
Use new \compares command in the documentation to describe the
comparison operators provided by QUrlQuery.
Task-number: QTBUG-120303
Change-Id: I083487a134887010ebbb78906d2c1982f2ad41b5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/corelib/io/qurlquery.cpp')
| -rw-r--r-- | src/corelib/io/qurlquery.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp index 1258c00ec2c..31f3ee1d902 100644 --- a/src/corelib/io/qurlquery.cpp +++ b/src/corelib/io/qurlquery.cpp @@ -24,6 +24,8 @@ QT_BEGIN_NAMESPACE \ingroup network \ingroup shared + \compares equality + It is used to parse the query strings found in URLs like the following: \image qurl-querystring.png @@ -399,22 +401,25 @@ QUrlQuery::~QUrlQuery() } /*! - Returns \c true if this object and the \a other object contain the same + \fn bool QUrlQuery::operator==(const QUrlQuery &lhs, const QUrlQuery &rhs) + + Returns \c true if QUrlQuery objects \a lhs and \a rhs contain the same contents, in the same order, and use the same query delimiters. */ -bool QUrlQuery::operator ==(const QUrlQuery &other) const + +bool comparesEqual(const QUrlQuery &lhs, const QUrlQuery &rhs) { - if (d == other.d) + if (lhs.d == rhs.d) return true; - if (d && other.d) + if (lhs.d && rhs.d) // keep in sync with qHash(QUrlQuery): - return d->valueDelimiter == other.d->valueDelimiter && - d->pairDelimiter == other.d->pairDelimiter && - d->itemList == other.d->itemList; + return lhs.d->valueDelimiter == rhs.d->valueDelimiter && + lhs.d->pairDelimiter == rhs.d->pairDelimiter && + lhs.d->itemList == rhs.d->itemList; - const QUrlQueryPrivate *x = d ? d.data() : other.d.data(); - return x->valueDelimiter == defaultQueryValueDelimiter() && - x->pairDelimiter == defaultQueryPairDelimiter() && + const QUrlQueryPrivate *x = lhs.d ? lhs.d.data() : rhs.d.data(); + return x->valueDelimiter == QUrlQuery::defaultQueryValueDelimiter() && + x->pairDelimiter == QUrlQuery::defaultQueryPairDelimiter() && x->itemList.isEmpty(); } @@ -810,9 +815,10 @@ void QUrlQuery::removeAllQueryItems(const QString &key) */ /*! - \fn bool QUrlQuery::operator!=(const QUrlQuery &other) const + \fn bool QUrlQuery::operator!=(const QUrlQuery &lhs, const QUrlQuery &rhs) - Returns \c true if \a other is not equal to this QUrlQuery. Otherwise, returns \c false. + Returns \c true if the QUrlQuery object \a rhs is not equal to \a lhs. + Otherwise, returns \c false. \sa operator==() */ |
