![]() |
Qt 6.x
The Qt SDK
|
The QIterator is a template class that allows iteration over a container in a QVariant. More...
#include <qiterable.h>
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 . | |
QIterator & | operator++ () |
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. | |
QIterator & | operator-- () |
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. | |
QIterator & | operator+= (qsizetype j) |
Advances the iterator by j items. | |
QIterator & | operator-= (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 |
Returns the distance between the two iterators. | |
![]() | |
void * | mutableIterator () |
Returns a non-const pointer to the internal native iterator. | |
const void * | constIterator () 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 | |
![]() | |
QBaseIterator ()=default | |
QBaseIterator (const QIterable< Container > *iterable, void *iterator) | |
QBaseIterator (QIterable< Container > *iterable, void *iterator) | |
QBaseIterator (QBaseIterator &&other) | |
QBaseIterator (const QBaseIterator &other) | |
~QBaseIterator () | |
QBaseIterator & | operator= (QBaseIterator &&other) |
QBaseIterator & | operator= (const QBaseIterator &other) |
QIterable< Container > * | mutableIterable () const |
const QIterable< Container > * | constIterable () const |
void | initIterator (const void *copy) |
void | clearIterator () |
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.
Definition at line 214 of file qiterable.h.
Definition at line 217 of file qiterable.h.
|
inlineexplicit |
Creates an iterator from an iterable and a pointer to a native iterator.
Definition at line 219 of file qiterable.h.
References Q_ASSERT.
|
inline |
Returns true
if other points to a different item than this iterator; otherwise returns false
.
Definition at line 230 of file qiterable.h.
References QBaseIterator< Container >::constIterator(), and QBaseIterator< Container >::metaContainer().
|
inline |
Returns an iterator to the item at j positions forward from this iterator.
Definition at line 279 of file qiterable.h.
References j, QBaseIterator< Container >::metaContainer(), QIterable< Container >::mutableIterable(), QBaseIterator< Container >::mutableIterable(), and this.
|
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::end() leads to undefined results.
Definition at line 235 of file qiterable.h.
References QBaseIterator< Container >::metaContainer(), and QBaseIterator< Container >::mutableIterator().
|
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 241 of file qiterable.h.
References QBaseIterator< Container >::metaContainer(), QIterable< Container >::mutableIterable(), QBaseIterator< Container >::mutableIterable(), QBaseIterator< Container >::mutableIterator(), and this.
|
inline |
Advances the iterator by j items.
Definition at line 267 of file qiterable.h.
References QBaseIterator< Container >::metaContainer(), and QBaseIterator< Container >::mutableIterator().
|
inline |
Returns the distance between the two iterators.
Definition at line 299 of file qiterable.h.
References QBaseIterator< Container >::constIterator(), and QBaseIterator< Container >::metaContainer().
|
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.
Definition at line 289 of file qiterable.h.
References j, QBaseIterator< Container >::metaContainer(), QIterable< Container >::mutableIterable(), QBaseIterator< Container >::mutableIterable(), and this.
|
inline |
The prefix {–} operator (
{–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.
Definition at line 251 of file qiterable.h.
References QBaseIterator< Container >::metaContainer(), and QBaseIterator< Container >::mutableIterator().
|
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.
Definition at line 257 of file qiterable.h.
References QBaseIterator< Container >::metaContainer(), QIterable< Container >::mutableIterable(), QBaseIterator< Container >::mutableIterable(), QBaseIterator< Container >::mutableIterator(), and this.
|
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.
Definition at line 273 of file qiterable.h.
References QBaseIterator< Container >::metaContainer(), and QBaseIterator< Container >::mutableIterator().
|
inline |
Returns true
if other points to the same item as this iterator; otherwise returns false
.
Definition at line 225 of file qiterable.h.
References QBaseIterator< Container >::constIterator(), and QBaseIterator< Container >::metaContainer().
|
friend |
Returns an iterator to the item at j positions forward from iterator k.
Definition at line 304 of file qiterable.h.