/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \class QLinkedListIterator
    \inmodule QtCore5Compat

    \brief The QLinkedListIterator class provides a Java-style const iterator for QLinkedList.

    QLinkedList has both \l{Java-style iterators} and
    \l{STL-style iterators}. The Java-style iterators are more
    high-level and easier to use than the STL-style iterators; on the
    other hand, they are slightly less efficient.

    QLinkedListIterator\<T\> allows you to iterate over a
    QLinkedList\<T\>. If you want to modify the list as you iterate
    over it, use QMutableLinkedListIterator\<T\> instead.

    The QLinkedListIterator constructor takes a QLinkedList as
    argument. After construction, the iterator is located at the very
    beginning of the list (before the first item). Here's how to
    iterate over all the elements sequentially:

    \snippet code/doc_src_qiterator.cpp 2

    The next() function returns the next item in the list and
    advances the iterator. Unlike STL-style iterators, Java-style
    iterators point \e between items rather than directly \e at
    items. The first call to next() advances the iterator to the
    position between the first and second item, and returns the first
    item; the second call to next() advances the iterator to the
    position between the second and third item, and returns the second
    item; and so on.

    \image javaiterators1.png

    Here's how to iterate over the elements in reverse order:

    \snippet code/doc_src_qiterator.cpp 3

    If you want to find all occurrences of a particular value, use
    findNext() or findPrevious() in a loop.

    Multiple iterators can be used on the same list. If the list is
    modified while a QLinkedListIterator is active, the
    QLinkedListIterator will continue iterating over the original
    list, ignoring the modified copy.

    \sa QMutableLinkedListIterator, QLinkedList::const_iterator
*/

/*!
    \class QMutableLinkedListIterator
    \inmodule QtCore5Compat

    \brief The QMutableLinkedListIterator class provides a Java-style non-const iterator for QLinkedList.

    QLinkedList has both \l{Java-style iterators} and
    \l{STL-style iterators}. The Java-style iterators are more
    high-level and easier to use than the STL-style iterators; on the
    other hand, they are slightly less efficient.

    QMutableLinkedListIterator\<T\> allows you to iterate over a
    QLinkedList\<T\> and modify the list. If you don't want to modify
    the list (or have a const QLinkedList), use the slightly faster
    QLinkedListIterator\<T\> instead.

    The QMutableLinkedListIterator constructor takes a QLinkedList as
    argument. After construction, the iterator is located at the very
    beginning of the list (before the first item). Here's how to
    iterate over all the elements sequentially:

    \snippet code/doc_src_qiterator.cpp 11

    The next() function returns the next item in the list and
    advances the iterator. Unlike STL-style iterators, Java-style
    iterators point \e between items rather than directly \e at
    items. The first call to next() advances the iterator to the
    position between the first and second item, and returns the first
    item; the second call to next() advances the iterator to the
    position between the second and third item, returning the second
    item; and so on.

    \image javaiterators1.png

    Here's how to iterate over the elements in reverse order:

    \snippet code/doc_src_qiterator.cpp 12

    If you want to find all occurrences of a particular value, use
    findNext() or findPrevious() in a loop.

    If you want to remove items as you iterate over the list, use
    remove(). If you want to modify the value of an item, use
    setValue(). If you want to insert a new item in the list, use
    insert().

    Example:
    \snippet code/doc_src_qiterator.cpp 13

    The example traverses a list, replacing negative numbers with
    their absolute values, and eliminating zeroes.

    Only one mutable iterator can be active on a given list at any
    time. Furthermore, no changes should be done directly to the list
    while the iterator is active (as opposed to through the
    iterator), since this could invalidate the iterator and lead to
    undefined behavior.

    \sa QLinkedListIterator, QLinkedList::iterator
*/

/*!
    \fn template <class T> QLinkedListIterator<T>::QLinkedListIterator(const QLinkedList<T> &list)
    \fn template <class T> QMutableLinkedListIterator<T>::QMutableLinkedListIterator(QLinkedList<T> &list)

    Constructs an iterator for traversing \a list. The iterator is
    set to be at the front of the list (before the first item).

    \sa operator=()
*/

/*!
    \fn template <class T> QMutableLinkedListIterator &QMutableLinkedListIterator<T>::operator=(QLinkedList<T> &list)
    \fn template <class T> QLinkedListIterator &QLinkedListIterator<T>::operator=(const QLinkedList<T> &list)

    Makes the iterator operate on \a list. The iterator is set to be
    at the front of the list (before the first item).

    \sa toFront(), toBack()
*/

/*!
    \fn template <class T> void QLinkedListIterator<T>::toFront()
    \fn template <class T> void QMutableLinkedListIterator<T>::toFront()

    Moves the iterator to the front of the container (before the
    first item).

    \sa toBack(), next()
*/

/*!
    \fn template <class T> void QLinkedListIterator<T>::toBack()
    \fn template <class T> void QMutableLinkedListIterator<T>::toBack()

    Moves the iterator to the back of the container (after the last
    item).

    \sa toFront(), previous()
*/

/*!
    \fn template <class T> bool QLinkedListIterator<T>::hasNext() const
    \fn template <class T> bool QMutableLinkedListIterator<T>::hasNext() const

    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.

    \sa hasPrevious(), next()
*/

/*!
    \fn template <class T> const T &QLinkedListIterator<T>::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.

    \sa hasNext(), peekNext(), previous()
*/

/*!
    \fn template <class T> T &QMutableLinkedListIterator<T>::next()

    Returns a reference to 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.

    \sa hasNext(), peekNext(), previous()
*/

/*!
    \fn template <class T> const T &QLinkedListIterator<T>::peekNext() const

    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.

    \sa hasNext(), next(), peekPrevious()
*/

/*!
    \fn template <class T> T &QMutableLinkedListIterator<T>::peekNext() const

    Returns a reference to the next item, without moving the iterator.

    Calling this function on an iterator located at the back of the
    container leads to undefined results.

    \sa hasNext(), next(), peekPrevious()
*/

/*!
    \fn template <class T> bool QLinkedListIterator<T>::hasPrevious() const
    \fn template <class T> bool QMutableLinkedListIterator<T>::hasPrevious() const

    Returns \c true if there is at least one item behind the iterator,
    i.e. the iterator is \e not at the front of the container;
    otherwise returns \c false.

    \sa hasNext(), previous()
*/

/*!
    \fn template <class T> const T &QLinkedListIterator<T>::previous()

    Returns the previous item and moves the iterator back by one
    position.

    Calling this function on an iterator located at the front of the
    container leads to undefined results.

    \sa hasPrevious(), peekPrevious(), next()
*/

/*!
    \fn template <class T> T &QMutableLinkedListIterator<T>::previous()

    Returns a reference to the previous item and moves the iterator
    back by one position.

    Calling this function on an iterator located at the front of the
    container leads to undefined results.

    \sa hasPrevious(), peekPrevious(), next()
*/

/*!
    \fn template <class T> const T &QLinkedListIterator<T>::peekPrevious() const

    Returns the previous item without moving the iterator.

    Calling this function on an iterator located at the front of the
    container leads to undefined results.

    \sa hasPrevious(), previous(), peekNext()
*/

/*!
    \fn template <class T> T &QMutableLinkedListIterator<T>::peekPrevious() const

    Returns a reference to the previous item, without moving the iterator.

    Calling this function on an iterator located at the front of the
    container leads to undefined results.

    \sa hasPrevious(), previous(), peekNext()
*/

/*!
    \fn template <class T> bool QLinkedListIterator<T>::findNext(const T &value)
    \fn template <class T> bool QMutableLinkedListIterator<T>::findNext(const T &value)

    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.

    \sa findPrevious()
*/

/*!
    \fn template <class T> bool QLinkedListIterator<T>::findPrevious(const T &value)
    \fn template <class T> bool QMutableLinkedListIterator<T>::findPrevious(const T &value)

    Searches for \a value starting from the current iterator position
    backward. Returns \c true if \a value is found; otherwise returns
    false.

    After the call, if \a value was found, the iterator is positioned
    just before the matching item; otherwise, the iterator is
    positioned at the front of the container.

    \sa findNext()
*/

/*! \fn template <class T> void QMutableLinkedListIterator<T>::remove()

    Removes the last item that was jumped over using one of the
    traversal functions (next(), previous(), findNext(), findPrevious()).

    Example:
    \snippet code/doc_src_qiterator.cpp 20

    \sa insert(), setValue()
*/

/*! \fn template <class T> void QMutableLinkedListIterator<T>::setValue(const T &value) const

    Replaces the value of the last item that was jumped over using
    one of the traversal functions with \a value.

    The traversal functions are next(), previous(), findNext(), and
    findPrevious().

    Example:
    \snippet code/doc_src_qiterator.cpp 24

    \sa value(), remove(), insert()
*/

/*!
    \fn template <class T> const T &QMutableLinkedListIterator<T>::value() const

    Returns the value of the last item that was jumped over using one
    of the traversal functions (next(), previous(), findNext(),
    findPrevious()).

    After a call to next() or findNext(), value() is equivalent to
    peekPrevious(). After a call to previous() or findPrevious(), value() is
    equivalent to peekNext().
*/

/*!
    \fn template <class T> T &QMutableLinkedListIterator<T>::value()
    \overload

    Returns a non-const reference to the value of the last item that
    was jumped over using one of the traversal functions.
*/

/*!
    \fn template <class T> void QMutableLinkedListIterator<T>::insert(const T &value)

    Inserts \a value at the current iterator position. After the
    call, the iterator is located just after the inserted item.

    \sa remove(), setValue()
*/
