/**************************************************************************** ** ** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL3 included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or (at your option) the GNU General ** Public license version 3 or any later version approved by the KDE Free ** Qt Foundation. The licenses are as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-2.0.html and ** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include QT_BEGIN_NAMESPACE /*! \class QBaseIterator QBaseIterator forms the common base class for all iterators operating on subclasses of QIterable. */ /*! \fn template QBaseIterator::QBaseIterator(const QIterable *iterable, void *iterator) \internal Creates a const QBaseIterator from an \a iterable and an \a iterator. */ /*! \fn template QBaseIterator::QBaseIterator(QIterable *iterable, void *iterator) \internal Creates a non-const QBaseIterator from an \a iterable and an \a iterator. */ /*! \fn template QBaseIterator::QBaseIterator(QBaseIterator &&other) \internal Move-constructs a QBaseIterator from \a other, preserving its const-ness. */ /*! \fn template QBaseIterator::QBaseIterator(const QBaseIterator &other) \internal Copy-constructs a QBaseIterator from \a other, preserving its const-ness. */ /*! \fn template QBaseIterator::~QBaseIterator() \internal Destroys a QBaseIterator. */ /*! \fn template QBaseIterator &QBaseIterator::operator=(const QBaseIterator &other) \internal Copy-assigns a QBaseIterator from \a other, preserving its const-ness. */ /*! \fn template void QBaseIterator::initIterator(const void *copy) \internal Initializes the internal native iterator by duplicating \a copy, if given. */ /*! \fn template void QBaseIterator::clearIterator() \internal Destroys the internal native iterator. */ /*! \fn QMetaContainer QBaseIterator::metaContainer() const \internal Returns the meta sequence. */ /*! \fn template QIterable *QBaseIterator::mutableIterable() const \internal Returns a non-const pointer to the iterable, if the original iterable was non-const. Otherwise returns nullptr. */ /*! \fn template const QIterable *QBaseIterator::constIterable() const \internal Returns a const pointer to the iterable. */ /*! \fn template void *QBaseIterator::mutableIterator() Returns a non-const pointer to the internal native iterator. */ /*! \fn template const void *QBaseIterator::constIterator() const Returns a const pointer to the internal native iterator. */ /*! \fn template QBaseIterator &QBaseIterator::operator=(QBaseIterator &&other) \internal Move-assigns a QBaseIterator from \a other, preserving its const-ness. */ /*! \class QIterator \since 6.0 \inmodule QtCore \brief The QIterator is a template class that allows iteration over a container in a QVariant. A QIterator can only be created by a QIterable instance, and can be used in a way similar to other stl-style iterators. Generally, QIterator should not be used directly, but through its derived classes provided by QSequentialIterable and QAssociativeIterable. \sa QIterable */ /*! \fn template QIterator::QIterator(QIterable *iterable, void *iterator) Creates an iterator from an \a iterable and a pointer to a native \a iterator. */ /*! \fn template bool QIterator::operator==(const QIterator &other) const Returns \c true if \a other points to the same item as this iterator; otherwise returns \c false. \sa operator!=() */ /*! \fn template bool QIterator::operator!=(const QIterator &other) const Returns \c true if \a other points to a different item than this iterator; otherwise returns \c false. \sa operator==() */ /*! \fn template QIterator &QIterator::operator++() The prefix ++ operator (\c{++it}) advances the iterator to the next item in the container and returns an iterator to the new current item. Calling this function on QSequentialIterable::end() leads to undefined results. \sa operator--() */ /*! \fn template QIterator QIterator::operator++(int) \overload The postfix ++ operator (\c{it++}) advances the iterator to the next item in the container and returns an iterator to the previously current item. */ /*! \fn template QIterator &QIterator::operator--() The prefix -- operator (\c{--it}) makes the preceding item current and returns an iterator to the new current item. Calling this function on QSequentialIterable::begin() leads to undefined results. If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results. \sa operator++(), QIterable::canReverseIterate() */ /*! \fn template QIterator QIterator::operator--(int) \overload The postfix -- operator (\c{it--}) makes the preceding item current and returns an iterator to the previously current item. If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results. \sa QIterable::canReverseIterate() */ /*! \fn template QIterator &QIterator::operator+=(qsizetype j) Advances the iterator by \a j items. \sa operator-=(), operator+() */ /*! \fn template QIterator &QIterator::operator-=(qsizetype j) Makes the iterator go back by \a j items. If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results. \sa operator+=(), operator-(), QIterable::canReverseIterate() */ /*! \fn template QIterator QIterator::operator+(qsizetype j) const Returns an iterator to the item at \a j positions forward from this iterator. \sa operator-(), operator+=() */ /*! \fn template QIterator QIterator::operator-(qsizetype j) const Returns an iterator to the item at \a j positions backward from this iterator. If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results. \sa operator+(), operator-=(), QIterable::canReverseIterate() */ /*! \fn template qsizetype QIterator::operator-(const QIterator &j) const Returns the distance between the two iterators. \sa operator+(), operator-=(), QIterable::canReverseIterate() */ /*! \fn template QIterator QIterator::operator+(qsizetype j, const QIterator &k) Returns an iterator to the item at \a j positions forward from iterator \a k. */ /*! \struct QConstIterator \since 6.0 \inmodule QtCore \brief The QConstIterator allows iteration over a container in a QVariant. \sa QIterator, QIterable */ /*! \fn template QConstIterator::QConstIterator(const QIterable *iterable, void *iterator) Creates a QConstIterator to wrap \a iterator, operating on \a iterable. */ /*! \fn template bool QConstIterator::operator==(const QConstIterator &other) const Returns \c true if \a other points to the same item as this iterator; otherwise returns \c false. \sa operator!=() */ /*! \fn template bool QConstIterator::operator!=(const QConstIterator &other) const Returns \c true if \a other points to a different item than this iterator; otherwise returns \c false. \sa operator==() */ /*! \fn template QConstIterator &QConstIterator::operator++() The prefix ++ operator (\c{++it}) advances the iterator to the next item in the container and returns an iterator to the new current item. Calling this function on QIterable::end() leads to undefined results. \sa operator--() */ /*! \fn template QConstIterator QConstIterator::operator++(int) \overload The postfix ++ operator (\c{it++}) advances the iterator to the next item in the container and returns an iterator to the previously current item. */ /*! \fn template QConstIterator &QConstIterator::operator--() The prefix -- operator (\c{--it}) makes the preceding item current and returns an iterator to the new current item. Calling this function on QIterable::begin() leads to undefined results. If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results. \sa operator++(), QIterable::canReverseIterate() */ /*! \fn template QConstIterator QConstIterator::operator--(int) \overload The postfix -- operator (\c{it--}) makes the preceding item current and returns an iterator to the previously current item. If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results. \sa QIterable::canReverseIterate() */ /*! \fn template QConstIterator &QConstIterator::operator+=(qsizetype j) Advances the iterator by \a j items. \sa operator-=(), operator+() */ /*! \fn template QConstIterator &QConstIterator::operator-=(qsizetype j) Makes the iterator go back by \a j items. If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results. \sa operator+=(), operator-(), QIterable::canReverseIterate() */ /*! \fn template QConstIterator QConstIterator::operator+(qsizetype j) const Returns an iterator to the item at \a j positions forward from this iterator. \sa operator-(), operator+=() */ /*! \fn template QConstIterator QConstIterator::operator-(qsizetype j) const Returns an iterator to the item at \a j positions backward from this iterator. If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results. \sa operator+(), operator-=(), QIterable::canReverseIterate() */ /*! \fn template qsizetype QConstIterator::operator-(const QConstIterator &j) const Returns the distance between the two iterators. \sa operator+(), operator-=(), QIterable::canReverseIterate() */ /*! \class QIterable \inmodule QtCore \since 6.0 \brief QIterable is a template class that is the base class for QSequentialIterable and QAssociativeIterable. */ /*! \fn template bool QIterable::canInputIterate() const Returns whether the container has an input iterator. This corresponds to the std::input_iterator_tag iterator trait of the iterator and const_iterator of the container. */ /*! \fn template bool QIterable::canForwardIterate() const Returns whether it is possible to iterate over the container in forward direction. This corresponds to the std::forward_iterator_tag iterator trait of the iterator and const_iterator of the container. */ /*! \fn template bool QIterable::canReverseIterate() const Returns whether it is possible to iterate over the container in reverse. This corresponds to the std::bidirectional_iterator_tag iterator trait of the const_iterator of the container. */ /*! \fn template bool QIterable::canRandomAccessIterate() const Returns whether it is possible to efficiently skip over multiple values using and iterator. This corresponds to the std::random_access_iterator_tag iterator trait of the iterator and const_iterator of the container. */ /*! \fn template QConstIterator QIterable::constBegin() const Returns a QConstIterator for the beginning of the container. This can be used in stl-style iteration. \sa constEnd(), mutableBegin() */ /*! \fn template QConstIterator QIterable::constEnd() const Returns a Qterable::QConstIterator for the end of the container. This can be used in stl-style iteration. \sa constBegin(), mutableEnd() */ /*! \fn template QIterator QIterable::mutableBegin() Returns a QIterator for the beginning of the container. This can be used in stl-style iteration. \sa mutableEnd(), constBegin() */ /*! \fn template QIterator QIterable::mutableEnd() Returns a QSequentialIterable::iterator for the end of the container. This can be used in stl-style iteration. \sa mutableBegin(), constEnd() */ /*! \fn template qsizetype QIterable::size() const Returns the number of values in the container. */ /*! \class QTaggedIterator \since 6.0 \inmodule QtCore \brief QTaggedIterator is a template class that wraps an iterator and exposes standard iterator traits. In order to use an iterator any of the standard algorithms, its iterator traits need to be known. As QSequentialIterable can work with many different kinds of containers, we cannot declare the traits in the iterator classes themselves. A QTaggedIterator gives you a way to explicitly declare a trait for a concrete instance of an iterator or QConstIterator. */ /*! \fn template QTaggedIterator::QTaggedIterator(Iterator &&it) Constructs a QTaggedIterator from an iterator or QConstIterator \a it. Checks whether the IteratorCategory passed as template argument matches the run time capabilities of \a it; if there's no match, \a it is refused. */ /*! \fn template bool QTaggedIterator::operator==(const QTaggedIterator &other) const Returns \c true if \a other points to the same item as this iterator; otherwise returns \c false. \sa operator!=() */ /*! \fn template bool QTaggedIterator::operator!=(const QTaggedIterator &other) const Returns \c true if \a other points to a different item than this iterator; otherwise returns \c false. \sa operator==() */ /*! \fn template QTaggedIterator &QTaggedIterator::operator++() The prefix ++ operator (\c{++it}) advances the iterator to the next item in the container and returns an iterator to the new current item. Calling this function on QSequentialIterable::end() leads to undefined results. \sa operator--() */ /*! \fn template QTaggedIterator QTaggedIterator::operator++(int) \overload The postfix ++ operator (\c{it++}) advances the iterator to the next item in the container and returns an iterator to the previously current item. */ /*! \fn template QTaggedIterator &QTaggedIterator::operator--() The prefix -- operator (\c{--it}) makes the preceding item current and returns an iterator to the new current item. Calling this function on QSequentialIterable::begin() leads to undefined results. If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results. \sa operator++(), QIterable::canReverseIterate() */ /*! \fn template QTaggedIterator QTaggedIterator::operator--(int) \overload The postfix -- operator (\c{it--}) makes the preceding item current and returns an iterator to the previously current item. If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results. \sa QIterable::canReverseIterate() */ /*! \fn template QTaggedIterator &QTaggedIterator::operator+=(qsizetype j) Advances the iterator by \a j items. \sa operator-=(), operator+() */ /*! \fn template QTaggedIterator &QTaggedIterator::operator-=(qsizetype j) Makes the iterator go back by \a j items. If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results. \sa operator+=(), operator-(), QIterable::canReverseIterate() */ /*! \fn template QTaggedIterator QTaggedIterator::operator+(qsizetype j) const Returns an iterator to the item at \a j positions forward from this iterator. \sa operator-(), operator+=() */ /*! \fn template QTaggedIterator QTaggedIterator::operator+(qsizetype j, const QTaggedIterator &k) Returns an iterator to the item at \a j positions forward from iterator \a k. */ /*! \fn template QTaggedIterator QTaggedIterator::operator-(qsizetype j) const Returns an iterator to the item at \a j positions backward from this iterator. If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results. \sa operator+(), operator-=(), QIterable::canReverseIterate() */ /*! \fn template qsizetype QTaggedIterator::operator-(const QTaggedIterator &j) const Returns the distance between this iterator and \a j. \sa operator+(), operator-=(), QIterable::canReverseIterate() */ QT_END_NAMESPACE