Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QTaggedIterator< Iterator, IteratorCategory > Class Template Reference

QTaggedIterator is a template class that wraps an iterator and exposes standard iterator traits. More...

#include <qiterable.h>

Inheritance diagram for QTaggedIterator< Iterator, IteratorCategory >:
Collaboration diagram for QTaggedIterator< Iterator, IteratorCategory >:

Public Types

using iterator_category = IteratorCategory

Public Member Functions

 QTaggedIterator (Iterator &&it)
 Constructs a QTaggedIterator from an iterator or QConstIterator it.
bool operator== (const QTaggedIterator &o) const
 Returns true if other points to the same item as this iterator; otherwise returns false.
bool operator!= (const QTaggedIterator &o) const
 Returns true if other points to a different item than this iterator; otherwise returns false.
QTaggedIteratoroperator++ ()
 The prefix {++} operator ({++it}) advances the iterator to the next item in the container and returns an iterator to the new current item.
QTaggedIterator operator++ (int x)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The postfix {++} operator ({it++}) advances the iterator to the next item in the container and returns an iterator to the previously current item.
QTaggedIteratoroperator-- ()
 The prefix {–} operator ({–it}) makes the preceding item current and returns an iterator to the new current item.
QTaggedIterator operator-- (int x)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The postfix {–} operator ({it–}) makes the preceding item current and returns an iterator to the previously current item.
QTaggedIteratoroperator+= (qsizetype j)
 Advances the iterator by j items.
QTaggedIteratoroperator-= (qsizetype j)
 Makes the iterator go back by j items.
QTaggedIterator operator+ (qsizetype j) const
 Returns an iterator to the item at j positions forward from this iterator.
QTaggedIterator operator- (qsizetype j) const
 Returns an iterator to the item at j positions backward from this iterator.
qsizetype operator- (const QTaggedIterator &j) const
 Returns the distance between this iterator and j.
bool operator< (const QTaggedIterator &j)
bool operator>= (const QTaggedIterator &j)
bool operator> (const QTaggedIterator &j)
bool operator<= (const QTaggedIterator &j)

Friends

QTaggedIterator operator+ (qsizetype j, const QTaggedIterator &k)
 Returns an iterator to the item at j positions forward from iterator k.

Detailed Description

template<class Iterator, typename IteratorCategory>
class QTaggedIterator< Iterator, IteratorCategory >

QTaggedIterator is a template class that wraps an iterator and exposes standard iterator traits.

Since
6.0 \inmodule QtCore

QTaggedIterator<Iterator, IteratorCategory> wraps an iterator, where Iterator is the underlying iterator type (such as QIterator or QConstIterator) and IteratorCategory is a standard iterator category tag (such as std::forward_iterator_tag or std::random_access_iterator_tag).

In order to use an iterator any of the standard algorithms, its iterator traits need to be known. As QMetaSequence::Iterable 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.

Definition at line 74 of file qiterable.h.

Member Typedef Documentation

◆ iterator_category

template<class Iterator, typename IteratorCategory>
using QTaggedIterator< Iterator, IteratorCategory >::iterator_category = IteratorCategory

Definition at line 77 of file qiterable.h.

Constructor & Destructor Documentation

◆ QTaggedIterator()

template<class Iterator, typename IteratorCategory>
QTaggedIterator< Iterator, IteratorCategory >::QTaggedIterator ( Iterator && it)
inline

Constructs a QTaggedIterator from an iterator or QConstIterator it.

Checks whether the IteratorCategory passed as template argument matches the run time capabilities of it; if there's no match, it is refused.

Definition at line 78 of file qiterable.h.

Referenced by QTaggedIterator< AssociativeIterator, void >::QTaggedIterator().

Here is the caller graph for this function:

Member Function Documentation

◆ operator!=()

template<class Iterator, typename IteratorCategory>
bool QTaggedIterator< Iterator, IteratorCategory >::operator!= ( const QTaggedIterator< Iterator, IteratorCategory > & o) const
inline

Returns true if other points to a different item than this iterator; otherwise returns false.

See also
operator==()

Definition at line 111 of file qiterable.h.

◆ operator+()

template<class Iterator, typename IteratorCategory>
QTaggedIterator QTaggedIterator< Iterator, IteratorCategory >::operator+ ( qsizetype j) const
inline

Returns an iterator to the item at j positions forward from this iterator.

See also
operator-(), operator+=()

Definition at line 118 of file qiterable.h.

◆ operator++() [1/2]

template<class Iterator, typename IteratorCategory>
QTaggedIterator & QTaggedIterator< Iterator, IteratorCategory >::operator++ ( )
inline

The prefix {++} operator ({++it}) advances the iterator to the next item in the container and returns an iterator to the new current item.

Calling this function on QMetaSequence::Iterable::constEnd() leads to undefined results.

See also
operator--()

Definition at line 112 of file qiterable.h.

◆ operator++() [2/2]

template<class Iterator, typename IteratorCategory>
QTaggedIterator QTaggedIterator< Iterator, IteratorCategory >::operator++ ( int x)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The postfix {++} operator ({it++}) advances the iterator to the next item in the container and returns an iterator to the previously current item.

Definition at line 113 of file qiterable.h.

◆ operator+=()

template<class Iterator, typename IteratorCategory>
QTaggedIterator & QTaggedIterator< Iterator, IteratorCategory >::operator+= ( qsizetype j)
inline

Advances the iterator by j items.

See also
operator-=(), operator+()

Definition at line 116 of file qiterable.h.

◆ operator-() [1/2]

template<class Iterator, typename IteratorCategory>
qsizetype QTaggedIterator< Iterator, IteratorCategory >::operator- ( const QTaggedIterator< Iterator, IteratorCategory > & j) const
inline

Returns the distance between this iterator and j.

See also
operator+(), operator-=(), QIterable::canReverseIterate()

Definition at line 120 of file qiterable.h.

◆ operator-() [2/2]

template<class Iterator, typename IteratorCategory>
QTaggedIterator QTaggedIterator< Iterator, IteratorCategory >::operator- ( qsizetype j) const
inline

Returns an iterator to the item at 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.

See also
operator+(), operator-=(), QIterable::canReverseIterate()

Definition at line 119 of file qiterable.h.

◆ operator--() [1/2]

template<class Iterator, typename IteratorCategory>
QTaggedIterator & QTaggedIterator< Iterator, IteratorCategory >::operator-- ( )
inline

The prefix {–} operator ({–it}) makes the preceding item current and returns an iterator to the new current item.

Calling this function on QMetaSequence::Iterable::constBegin() leads to undefined results.

If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results.

See also
operator++(), QIterable::canReverseIterate()

Definition at line 114 of file qiterable.h.

◆ operator--() [2/2]

template<class Iterator, typename IteratorCategory>
QTaggedIterator QTaggedIterator< Iterator, IteratorCategory >::operator-- ( int x)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The postfix {–} operator ({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.

See also
QIterable::canReverseIterate()

Definition at line 115 of file qiterable.h.

◆ operator-=()

template<class Iterator, typename IteratorCategory>
QTaggedIterator & QTaggedIterator< Iterator, IteratorCategory >::operator-= ( qsizetype j)
inline

Makes the iterator go back by j items.

If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results.

See also
operator+=(), operator-(), QIterable::canReverseIterate()

Definition at line 117 of file qiterable.h.

◆ operator<()

template<class Iterator, typename IteratorCategory>
bool QTaggedIterator< Iterator, IteratorCategory >::operator< ( const QTaggedIterator< Iterator, IteratorCategory > & j)
inline

Definition at line 122 of file qiterable.h.

Referenced by QTaggedIterator< AssociativeIterator, void >::operator>=().

Here is the caller graph for this function:

◆ operator<=()

template<class Iterator, typename IteratorCategory>
bool QTaggedIterator< Iterator, IteratorCategory >::operator<= ( const QTaggedIterator< Iterator, IteratorCategory > & j)
inline

Definition at line 125 of file qiterable.h.

◆ operator==()

template<class Iterator, typename IteratorCategory>
bool QTaggedIterator< Iterator, IteratorCategory >::operator== ( const QTaggedIterator< Iterator, IteratorCategory > & o) const
inline

Returns true if other points to the same item as this iterator; otherwise returns false.

See also
operator!=()

Definition at line 110 of file qiterable.h.

◆ operator>()

template<class Iterator, typename IteratorCategory>
bool QTaggedIterator< Iterator, IteratorCategory >::operator> ( const QTaggedIterator< Iterator, IteratorCategory > & j)
inline

Definition at line 124 of file qiterable.h.

Referenced by QTaggedIterator< AssociativeIterator, void >::operator<=().

Here is the caller graph for this function:

◆ operator>=()

template<class Iterator, typename IteratorCategory>
bool QTaggedIterator< Iterator, IteratorCategory >::operator>= ( const QTaggedIterator< Iterator, IteratorCategory > & j)
inline

Definition at line 123 of file qiterable.h.

◆ operator+

template<class Iterator, typename IteratorCategory>
QTaggedIterator operator+ ( qsizetype j,
const QTaggedIterator< Iterator, IteratorCategory > & k )
friend

Returns an iterator to the item at j positions forward from iterator k.

Definition at line 127 of file qiterable.h.


The documentation for this class was generated from the following files: