diff options
author | Tatiana Borisova <tatiana.borisova@qt.io> | 2024-03-22 16:35:02 +0100 |
---|---|---|
committer | Tatiana Borisova <tatiana.borisova@qt.io> | 2024-04-12 19:31:51 +0200 |
commit | 92cc21b389aa6e7223ba94daa249092bbac460dc (patch) | |
tree | 84102232632585d81645443f4b514605bd1ee245 /src/corelib/serialization/qcbormap.cpp | |
parent | de2a467a77f338d4b1e0a5044b809bdaf413ca72 (diff) |
QCborMap iterators: use new comparison helper macros
New comparison macros are used for following classes:
- QCborMap::Iterator
- QCborMap::ConstIterator
Replace public operators operator==(), operator!=(), operator!<(), etc
of classes to friend methods comparesEqual(), compareThreeWay();
Use *_helper methods to have an access to protected members of
QCborValueConstRef class from friend functions.
Task-number: QTBUG-120300
Change-Id: I71b6febaf3f31ea7ba668d91c375b0a7b6827d21
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/corelib/serialization/qcbormap.cpp')
-rw-r--r-- | src/corelib/serialization/qcbormap.cpp | 94 |
1 files changed, 48 insertions, 46 deletions
diff --git a/src/corelib/serialization/qcbormap.cpp b/src/corelib/serialization/qcbormap.cpp index 00c0bb0b6d..038e0d61ce 100644 --- a/src/corelib/serialization/qcbormap.cpp +++ b/src/corelib/serialization/qcbormap.cpp @@ -1238,6 +1238,10 @@ void QCborMap::detach(qsizetype reserved) \brief The QCborMap::Iterator class provides an STL-style non-const iterator for QCborMap. + \compares strong + \compareswith strong ConstIterator + \endcompareswith + QCborMap::Iterator allows you to iterate over a QCborMap and to modify the value (but not the key) stored under a particular key. If you want to iterate over a const QCborMap, you should use QCborMap::ConstIterator. It @@ -1359,56 +1363,56 @@ void QCborMap::detach(qsizetype reserved) */ /*! - \fn bool QCborMap::Iterator::operator==(const Iterator &other) const - \fn bool QCborMap::Iterator::operator==(const ConstIterator &other) const + \fn bool QCborMap::Iterator::operator==(const Iterator &lhs, const Iterator &rhs) + \fn bool QCborMap::Iterator::operator==(const Iterator &lhs, const ConstIterator &rhs) - Returns \c true if \a other points to the same entry in the map as this + Returns \c true if \a lhs points to the same entry in the map as \a rhs iterator; otherwise returns \c false. \sa operator!=() */ /*! - \fn bool QCborMap::Iterator::operator!=(const Iterator &other) const - \fn bool QCborMap::Iterator::operator!=(const ConstIterator &other) const + \fn bool QCborMap::Iterator::operator!=(const Iterator &lhs, const Iterator &rhs) + \fn bool QCborMap::Iterator::operator!=(const Iterator &lhs, const ConstIterator &rhs) - Returns \c true if \a other points to a different entry in the map than - this iterator; otherwise returns \c false. + Returns \c true if \a lhs points to a different entry in the map than + \a rhs iterator; otherwise returns \c false. \sa operator==() */ /*! - \fn bool QCborMap::Iterator::operator<(const Iterator& other) const - \fn bool QCborMap::Iterator::operator<(const ConstIterator& other) const + \fn bool QCborMap::Iterator::operator<(const Iterator &lhs, const Iterator &rhs) + \fn bool QCborMap::Iterator::operator<(const Iterator &lhs, const ConstIterator &rhs) - Returns \c true if the entry in the map pointed to by this iterator - occurs before the entry pointed to by the \a other iterator. + Returns \c true if the entry in the map pointed to by \a lhs iterator + occurs before the entry pointed to by the \a rhs iterator. */ /*! - \fn bool QCborMap::Iterator::operator<=(const Iterator& other) const - \fn bool QCborMap::Iterator::operator<=(const ConstIterator& other) const + \fn bool QCborMap::Iterator::operator<=(const Iterator &lhs, const Iterator &rhs) + \fn bool QCborMap::Iterator::operator<=(const Iterator &lhs, const ConstIterator &rhs) - Returns \c true if the entry in the map pointed to by this iterator - occurs before or is the same entry as is pointed to by the \a other + Returns \c true if the entry in the map pointed to by \a lhs iterator + occurs before or is the same entry as is pointed to by the \a rhs iterator. */ /*! - \fn bool QCborMap::Iterator::operator>(const Iterator& other) const - \fn bool QCborMap::Iterator::operator>(const ConstIterator& other) const + \fn bool QCborMap::Iterator::operator>(const Iterator &lhs, const Iterator &rhs) + \fn bool QCborMap::Iterator::operator>(const Iterator &lhs, const ConstIterator &rhs) - Returns \c true if the entry in the map pointed to by this iterator - occurs after the entry pointed to by the \a other iterator. + Returns \c true if the entry in the map pointed to by \a lhs iterator + occurs after the entry pointed to by the \a rhs iterator. */ /*! - \fn bool QCborMap::Iterator::operator>=(const Iterator& other) const - \fn bool QCborMap::Iterator::operator>=(const ConstIterator& other) const + \fn bool QCborMap::Iterator::operator>=(const Iterator &lhs, const Iterator &rhs) + \fn bool QCborMap::Iterator::operator>=(const Iterator &lhs, const ConstIterator &rhs) - Returns \c true if the entry in the map pointed to by this iterator - occurs after or is the same entry as is pointed to by the \a other + Returns \c true if the entry in the map pointed to by \a lhs iterator + occurs after or is the same entry as is pointed to by the \a rhs iterator. */ @@ -1504,6 +1508,10 @@ void QCborMap::detach(qsizetype reserved) \brief The QCborMap::ConstIterator class provides an STL-style const iterator for QCborMap. + \compares strong + \compareswith strong Iterator + \endcompareswith + QCborMap::ConstIterator allows you to iterate over a QCborMap. If you want to modify the QCborMap as you iterate over it, you must use QCborMap::Iterator instead. It is generally good practice to use @@ -1604,56 +1612,50 @@ void QCborMap::detach(qsizetype reserved) */ /*! - \fn bool QCborMap::ConstIterator::operator==(const ConstIterator &other) const - \fn bool QCborMap::ConstIterator::operator==(const Iterator &other) const + \fn bool QCborMap::ConstIterator::operator==(const ConstIterator &lhs, const ConstIterator &rhs) - Returns \c true if \a other points to the same entry in the map as this + Returns \c true if \a lhs points to the same entry in the map as \a rhs iterator; otherwise returns \c false. \sa operator!=() */ /*! - \fn bool QCborMap::ConstIterator::operator!=(const ConstIterator &other) const - \fn bool QCborMap::ConstIterator::operator!=(const Iterator &other) const + \fn bool QCborMap::ConstIterator::operator!=(const ConstIterator &lhs, const ConstIterator &rhs) - Returns \c true if \a other points to a different entry in the map than - this iterator; otherwise returns \c false. + Returns \c true if \a lhs points to a different entry in the map than + \a rhs iterator; otherwise returns \c false. \sa operator==() */ /*! - \fn bool QCborMap::ConstIterator::operator<(const Iterator &other) const - \fn bool QCborMap::ConstIterator::operator<(const ConstIterator &other) const + \fn bool QCborMap::ConstIterator::operator<(const ConstIterator &lhs, const ConstIterator &rhs) - Returns \c true if the entry in the map pointed to by this iterator - occurs before the entry pointed to by the \a other iterator. + Returns \c true if the entry in the map pointed to by \a lhs iterator + occurs before the entry pointed to by the \a rhs iterator. */ /*! - \fn bool QCborMap::ConstIterator::operator<=(const Iterator &other) const - \fn bool QCborMap::ConstIterator::operator<=(const ConstIterator &other) const + \fn bool QCborMap::ConstIterator::operator<=(const ConstIterator &lhs, const ConstIterator &rhs) - Returns \c true if the entry in the map pointed to by this iterator - occurs before or is the same entry as is pointed to by the \a other + Returns \c true if the entry in the map pointed to by \a lhs iterator + occurs before or is the same entry as is pointed to by the \a rhs iterator. */ /*! - \fn bool QCborMap::ConstIterator::operator>(const Iterator &other) const - \fn bool QCborMap::ConstIterator::operator>(const ConstIterator &other) const + \fn bool QCborMap::ConstIterator::operator>(const ConstIterator &lhs, const ConstIterator &rhs) - Returns \c true if the entry in the map pointed to by this iterator - occurs after the entry pointed to by the \a other iterator. + Returns \c true if the entry in the map pointed to by \a lhs iterator + occurs after the entry pointed to by the \a rhs iterator. */ /*! - \fn bool QCborMap::ConstIterator::operator>=(const Iterator &other) const - \fn bool QCborMap::ConstIterator::operator>=(const ConstIterator &other) const + \fn bool QCborMap::ConstIterator::operator>=(const ConstIterator &lhs, const ConstIterator &rhs) - Returns \c true if the entry in the map pointed to by this iterator - occurs after or is the same entry as is pointed to by the \a other + Returns \c true if the entry in the map pointed to by \a lhs iterator + occurs after or is the same entry as is pointed to by the \a rhs iterator. */ |