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
QIterator< Container > Class Template Reference

The QIterator is a template class that allows iteration over a container in a QVariant. More...

#include <qiterable.h>

Inheritance diagram for QIterator< Container >:
Collaboration diagram for QIterator< Container >:

Public Types

using difference_type = qsizetype

Public Member Functions

 QIterator (QIterable< Container > *iterable, void *iterator)
 Creates an iterator from an iterable and a pointer to a native iterator.
bool operator== (const QIterator &o) const
 Returns true if other points to the same item as this iterator; otherwise returns false.
bool operator!= (const QIterator &o) const
 Returns true if other points to a different item than this iterator; otherwise returns false.
QIteratoroperator++ ()
 The prefix {++} operator ({++it}) advances the iterator to the next item in the container and returns an iterator to the new current item.
QIterator operator++ (int)
 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.
QIteratoroperator-- ()
 The prefix {–} operator ({–it}) makes the preceding item current and returns an iterator to the new current item.
QIterator operator-- (int)
 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.
QIteratoroperator+= (qsizetype j)
 Advances the iterator by j items.
QIteratoroperator-= (qsizetype j)
 Makes the iterator go back by j items.
QIterator operator+ (qsizetype j) const
 Returns an iterator to the item at j positions forward from this iterator.
QIterator operator- (qsizetype j) const
 Returns an iterator to the item at j positions backward from this iterator.
qsizetype operator- (const QIterator &j) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the distance between the two iterators.
Public Member Functions inherited from QBaseIterator< Container >
voidmutableIterator ()
 Returns a non-const pointer to the internal native iterator.
const voidconstIterator () const
 Returns a const pointer to the internal native iterator.
Container metaContainer () const

Friends

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

Additional Inherited Members

Protected Member Functions inherited from QBaseIterator< Container >
 QBaseIterator ()=default
 QBaseIterator (const QIterable< Container > *iterable, void *iterator)
 QBaseIterator (QIterable< Container > *iterable, void *iterator)
 QBaseIterator (QBaseIterator &&other)
 QBaseIterator (const QBaseIterator &other)
 ~QBaseIterator ()
QBaseIteratoroperator= (QBaseIterator &&other)
QBaseIteratoroperator= (const QBaseIterator &other)
QIterable< Container > * mutableIterable () const
const QIterable< Container > * constIterable () const
void initIterator (const void *copy)
void clearIterator ()

Detailed Description

template<class Container>
class QIterator< Container >

The QIterator is a template class that allows iteration over a container in a QVariant.

Since
6.0 \inmodule QtCore

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.

See also
QIterable

Definition at line 223 of file qiterable.h.

Member Typedef Documentation

◆ difference_type

template<class Container>
using QIterator< Container >::difference_type = qsizetype

Definition at line 226 of file qiterable.h.

Constructor & Destructor Documentation

◆ QIterator()

template<class Container>
QIterator< Container >::QIterator ( QIterable< Container > * iterable,
void * iterator )
inlineexplicit

Creates an iterator from an iterable and a pointer to a native iterator.

Definition at line 228 of file qiterable.h.

Member Function Documentation

◆ operator!=()

template<class Container>
bool QIterator< Container >::operator!= ( const QIterator< Container > & o) const
inline

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

See also
operator==()

Definition at line 239 of file qiterable.h.

◆ operator+()

template<class Container>
QIterator QIterator< Container >::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 288 of file qiterable.h.

◆ operator++() [1/2]

template<class Container>
QIterator & QIterator< Container >::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 QSequentialIterable::constEnd() leads to undefined results.

See also
operator--()

Definition at line 244 of file qiterable.h.

◆ operator++() [2/2]

template<class Container>
QIterator QIterator< Container >::operator++ ( int )
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 250 of file qiterable.h.

◆ operator+=()

template<class Container>
QIterator & QIterator< Container >::operator+= ( qsizetype j)
inline

Advances the iterator by j items.

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

Definition at line 276 of file qiterable.h.

◆ operator-() [1/2]

template<class Container>
qsizetype QIterator< Container >::operator- ( const QIterator< Container > & j) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the distance between the two iterators.

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

Definition at line 308 of file qiterable.h.

◆ operator-() [2/2]

template<class Container>
QIterator QIterator< Container >::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 298 of file qiterable.h.

◆ operator--() [1/2]

template<class Container>
QIterator & QIterator< Container >::operator-- ( )
inline

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

Calling this function on QSequentialIterable::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 260 of file qiterable.h.

◆ operator--() [2/2]

template<class Container>
QIterator QIterator< Container >::operator-- ( int )
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 266 of file qiterable.h.

◆ operator-=()

template<class Container>
QIterator & QIterator< Container >::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 282 of file qiterable.h.

◆ operator==()

template<class Container>
bool QIterator< Container >::operator== ( const QIterator< Container > & o) const
inline

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

See also
operator!=()

Definition at line 234 of file qiterable.h.

◆ operator+

template<class Container>
QIterator operator+ ( qsizetype j,
const QIterator< Container > & k )
friend

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

Definition at line 313 of file qiterable.h.


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