From 17bad8be11373b8a8683e0a3dc4cfe65a98ed76c Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 16 May 2023 10:12:32 +0200 Subject: [PATCH] Doc: fix warnings for QSetIterator see-alsos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends 0306247f5a5d057fedfa183da06a78cc41139d1d, which removed some APIs from QSetIterator as they couldn't be implemented without operator--. That resulted in qdoc warnings, which this patch removes by splitting the QSetIterator documentation into a separate block that quotes the previously shared documentation text, but uses a reduced set of see-also links. Change-Id: I2aac59b927a36216a718aa8e5d092ea4d9f6c15b Reviewed-by: Topi Reiniƶ --- .../doc/snippets/code/doc_src_qiterator.cpp | 9 ---- src/corelib/tools/qiterator.qdoc | 47 +++++++++++++++---- 2 files changed, 37 insertions(+), 19 deletions(-) diff --git a/src/corelib/doc/snippets/code/doc_src_qiterator.cpp b/src/corelib/doc/snippets/code/doc_src_qiterator.cpp index f033a7e1bbc..0d921b87e67 100644 --- a/src/corelib/doc/snippets/code/doc_src_qiterator.cpp +++ b/src/corelib/doc/snippets/code/doc_src_qiterator.cpp @@ -25,15 +25,6 @@ while (i.hasNext()) float f = i.next(); //! [6] - -//! [7] -QSetIterator i(set); -i.toBack(); -while (i.hasPrevious()) - QString s = i.previous(); -//! [7] - - //! [8] QList list; ... diff --git a/src/corelib/tools/qiterator.qdoc b/src/corelib/tools/qiterator.qdoc index 77336c1bd8a..f84d1cb3bae 100644 --- a/src/corelib/tools/qiterator.qdoc +++ b/src/corelib/tools/qiterator.qdoc @@ -213,12 +213,8 @@ \image javaiterators1.png - Here's how to iterate over the elements in reverse order: - - \snippet code/doc_src_qiterator.cpp 7 - If you want to find all occurrences of a particular value, use - findNext() or findPrevious() in a loop. + findNext() in a loop. Multiple iterators can be used on the same set. If the set is modified while a QSetIterator is active, the QSetIterator @@ -389,15 +385,21 @@ */ /*! \fn template void QListIterator::toBack() - \fn template void QSetIterator::toBack() \fn template void QMutableListIterator::toBack() +//! [toBack] Moves the iterator to the back of the container (after the last item). +//! [toBack] \sa toFront(), previous() */ +/*! \fn template void QSetIterator::toBack() + \include qiterator.qdoc toBack + \sa toFront() +*/ + /*! \fn template void QMutableSetIterator::toBack() Moves the iterator to the back of the container (after the last @@ -407,16 +409,22 @@ */ /*! \fn template bool QListIterator::hasNext() const - \fn template bool QSetIterator::hasNext() const \fn template bool QMutableListIterator::hasNext() const +//! [hasNext] Returns \c true if there is at least one item ahead of the iterator, i.e. the iterator is \e not at the back of the container; otherwise returns \c false. +//! [hasNext] \sa hasPrevious(), next() */ +/*! \fn template bool QSetIterator::hasNext() const + \include qiterator.qdoc hasNext + \sa next() +*/ + /*! \fn template bool QMutableSetIterator::hasNext() const Returns \c true if there is at least one item ahead of the iterator, @@ -427,16 +435,23 @@ */ /*! \fn template const T &QListIterator::next() - \fn template const T &QSetIterator::next() +//! [next] Returns the next item and advances the iterator by one position. Calling this function on an iterator located at the back of the container leads to undefined results. +//! [next] \sa hasNext(), peekNext(), previous() */ +/*! + \fn template const T &QSetIterator::next() + \include qiterator.qdoc next + \sa hasNext(), peekNext() +*/ + /* \fn template const T &QMutableSetIterator::next() Returns the next item and advances the iterator by one position. @@ -468,16 +483,23 @@ */ /*! \fn template const T &QListIterator::peekNext() const - \fn template const T &QSetIterator::peekNext() const +//! [peekNext] Returns the next item without moving the iterator. Calling this function on an iterator located at the back of the container leads to undefined results. +//! [peekNext] \sa hasNext(), next(), peekPrevious() */ +/*! + \fn template const T &QSetIterator::peekNext() const + \include qiterator.qdoc peekNext + \sa hasNext(), next() +*/ + /*! \fn template const T &QMutableSetIterator::peekNext() const @@ -563,19 +585,24 @@ */ /*! \fn template bool QListIterator::findNext(const T &value) - \fn template bool QSetIterator::findNext(const T &value) \fn template bool QMutableListIterator::findNext(const T &value) +//! [findNext] Searches for \a value starting from the current iterator position forward. Returns \c true if \a value is found; otherwise returns \c false. After the call, if \a value was found, the iterator is positioned just after the matching item; otherwise, the iterator is positioned at the back of the container. +//! [findNext] \sa findPrevious() */ +/*! \fn template bool QSetIterator::findNext(const T &value) + \include qiterator.qdoc findNext +*/ + /*! \fn template bool QListIterator::findPrevious(const T &value) \fn template bool QMutableListIterator::findPrevious(const T &value)