Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QCborMap::ConstIterator Class Reference

\inmodule QtCore More...

#include <qcbormap.h>

+ Collaboration diagram for QCborMap::ConstIterator:

Public Types

typedef std::random_access_iterator_tag iterator_category
 A synonym for {std::random_access_iterator_tag} indicating this iterator is a random-access iterator.
 
typedef qsizetype difference_type
 
typedef QPair< QCborValueConstRef, QCborValueConstRefvalue_type
 
typedef QPair< QCborValueConstRef, QCborValueConstRefreference
 
typedef QPair< QCborValueConstRef, QCborValueConstRefpointer
 

Public Member Functions

constexpr ConstIterator ()=default
 Constructs an uninitialized iterator.
 
constexpr ConstIterator (const ConstIterator &)=default
 Constructs an iterator as a copy of other.
 
ConstIteratoroperator= (const ConstIterator &other)
 Makes this iterator a copy of other and returns a reference to this iterator.
 
value_type operator* () const
 Returns a pair containing the current item's key and value.
 
value_type operator[] (qsizetype j) const
 
const QCborValueConstRefoperator-> () const
 Returns a pointer to the current pair's value.
 
QCborValueConstRef key () const
 Returns the current item's key.
 
QCborValueConstRef value () const
 Returns the current item's value.
 
bool operator== (const Iterator &o) const
 Returns true if other points to the same entry in the map as this iterator; otherwise returns false.
 
bool operator!= (const Iterator &o) const
 Returns true if other points to a different entry in the map than this iterator; otherwise returns false.
 
bool operator< (const Iterator &other) const
 
bool operator<= (const Iterator &other) const
 
bool operator> (const Iterator &other) const
 
bool operator>= (const Iterator &other) const
 
bool operator== (const ConstIterator &o) const
 
bool operator!= (const ConstIterator &o) const
 
bool operator< (const ConstIterator &other) const
 Returns true if the entry in the map pointed to by this iterator occurs before the entry pointed to by the other iterator.
 
bool operator<= (const ConstIterator &other) const
 Returns true if the entry in the map pointed to by this iterator occurs before or is the same entry as is pointed to by the other iterator.
 
bool operator> (const ConstIterator &other) const
 Returns true if the entry in the map pointed to by this iterator occurs after the entry pointed to by the other iterator.
 
bool operator>= (const ConstIterator &other) const
 Returns true if the entry in the map pointed to by this iterator occurs after or is the same entry as is pointed to by the other iterator.
 
ConstIteratoroperator++ ()
 The prefix {++} operator, {++i}, advances the iterator to the next item in the map and returns this iterator.
 
ConstIterator 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, {i++}, advances the iterator to the next item in the map and returns an iterator to the previously current item.
 
ConstIteratoroperator-- ()
 The prefix {–} operator, {–i}, makes the preceding item current and returns this iterator.
 
ConstIterator 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, {i–}, makes the preceding item current and returns an iterator pointing to the previously current item.
 
ConstIteratoroperator+= (qsizetype j)
 Advances the iterator by j items.
 
ConstIteratoroperator-= (qsizetype j)
 Makes the iterator go back by j items.
 
ConstIterator operator+ (qsizetype j) const
 Returns an iterator to the item at j positions forward from this iterator.
 
ConstIterator operator- (qsizetype j) const
 Returns an iterator to the item at j positions backward from this iterator.
 
qsizetype operator- (ConstIterator j) const
 Returns the position of the item at iterator j relative to the item at this iterator.
 

Friends

class Iterator
 
class QCborMap
 
class QCborValue
 
class QCborValueRef
 

Detailed Description

\inmodule QtCore

Since
5.12

The QCborMap::ConstIterator class provides an STL-style const iterator for QCborMap.

QCborMap::ConstIterator allows you to iterate over a QCborMap. If you want to modify the QCborMap as you iterate over it, you must use QCborMap::Iterator instead. It is generally good practice to use QCborMap::ConstIterator, even on a non-const QCborMap, when you don't need to change the QCborMap through the iterator. Const iterators are slightly faster and improve code readability.

You must initialize the iterator using a QCborMap function like QCborMap::begin(), QCborMap::end(), or QCborMap::find() before you can start iterating..

Multiple iterators can be used on the same object. Existing iterators will however become dangling if the object gets modified.

See also
QCborMap::Iterator

Definition at line 86 of file qcbormap.h.

Member Typedef Documentation

◆ difference_type

◆ iterator_category

A synonym for {std::random_access_iterator_tag} indicating this iterator is a random-access iterator.

Definition at line 95 of file qcbormap.h.

◆ pointer

Definition at line 99 of file qcbormap.h.

◆ reference

Definition at line 98 of file qcbormap.h.

◆ value_type

Definition at line 97 of file qcbormap.h.

Constructor & Destructor Documentation

◆ ConstIterator() [1/2]

QCborMap::ConstIterator::ConstIterator ( )
constexprdefault

Constructs an uninitialized iterator.

Functions like key(), value(), and operator++() must not be called on an uninitialized iterator. Use operator=() to assign a value to it before using it.

See also
QCborMap::constBegin(), QCborMap::constEnd()

◆ ConstIterator() [2/2]

QCborMap::ConstIterator::ConstIterator ( const ConstIterator other)
constexprdefault

Constructs an iterator as a copy of other.

Member Function Documentation

◆ key()

QString QCborMap::ConstIterator::key ( ) const
inline

Returns the current item's key.

See also
value()

Definition at line 119 of file qcbormap.h.

References item.

◆ operator!=() [1/2]

bool QCborMap::ConstIterator::operator!= ( const ConstIterator o) const
inline

Definition at line 129 of file qcbormap.h.

References o.

◆ operator!=() [2/2]

bool QCborMap::ConstIterator::operator!= ( const Iterator other) const
inline

Returns true if other points to a different entry in the map than this iterator; otherwise returns false.

See also
operator==()

Definition at line 123 of file qcbormap.h.

References o.

◆ operator*()

QCborMap::ConstIterator::value_type QCborMap::ConstIterator::operator* ( ) const
inline

Returns a pair containing the current item's key and value.

See also
key(), value()

Definition at line 111 of file qcbormap.h.

References item.

◆ operator+()

QCborMap::ConstIterator QCborMap::ConstIterator::operator+ ( qsizetype  j) const
inline

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

If j is negative, the iterator goes backward.

See also
operator-()

Definition at line 140 of file qcbormap.h.

References item, and j.

◆ operator++() [1/2]

QCborMap::ConstIterator & QCborMap::ConstIterator::operator++ ( )
inline

The prefix {++} operator, {++i}, advances the iterator to the next item in the map and returns this iterator.

Calling this function on QCborMap::end() leads to undefined results.

See also
operator--()

Definition at line 134 of file qcbormap.h.

References item.

◆ operator++() [2/2]

QCborMap::ConstIterator QCborMap::ConstIterator::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, {i++}, advances the iterator to the next item in the map and returns an iterator to the previously current item.

Definition at line 135 of file qcbormap.h.

References item.

◆ operator+=()

QCborMap::ConstIterator & QCborMap::ConstIterator::operator+= ( qsizetype  j)
inline

Advances the iterator by j items.

If j is negative, the iterator goes backward. Returns a reference to this iterator.

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

Definition at line 138 of file qcbormap.h.

References item, and j.

◆ operator-() [1/2]

qsizetype QCborMap::ConstIterator::operator- ( QCborMap::ConstIterator  j) const
inline

Returns the position of the item at iterator j relative to the item at this iterator.

If the item at j is forward of this time, the returned value is negative.

See also
operator+()

Definition at line 142 of file qcbormap.h.

References item, and j.

◆ operator-() [2/2]

QCborMap::ConstIterator QCborMap::ConstIterator::operator- ( qsizetype  j) const
inline

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

If j is negative, the iterator goes forward.

See also
operator+()

Definition at line 141 of file qcbormap.h.

References item, and j.

◆ operator--() [1/2]

QCborMap::ConstIterator & QCborMap::ConstIterator::operator-- ( )
inline

The prefix {–} operator, {–i}, makes the preceding item current and returns this iterator.

Calling this function on QCborMap::begin() leads to undefined results.

See also
operator++()

Definition at line 136 of file qcbormap.h.

References item.

◆ operator--() [2/2]

QCborMap::ConstIterator QCborMap::ConstIterator::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, {i–}, makes the preceding item current and returns an iterator pointing to the previously current item.

Definition at line 137 of file qcbormap.h.

References item.

◆ operator-=()

QCborMap::ConstIterator & QCborMap::ConstIterator::operator-= ( qsizetype  j)
inline

Makes the iterator go back by j items.

If j is negative, the iterator goes forward. Returns a reference to this iterator.

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

Definition at line 139 of file qcbormap.h.

References item, and j.

◆ operator->()

const QCborValueRef * QCborMap::ConstIterator::operator-> ( ) const
inline

Returns a pointer to the current pair's value.

Definition at line 113 of file qcbormap.h.

References item.

◆ operator<() [1/2]

bool QCborMap::ConstIterator::operator< ( const ConstIterator other) const
inline

Returns true if the entry in the map pointed to by this iterator occurs before the entry pointed to by the other iterator.

Definition at line 130 of file qcbormap.h.

References item, other(), and Q_ASSERT.

+ Here is the call graph for this function:

◆ operator<() [2/2]

bool QCborMap::ConstIterator::operator< ( const Iterator other) const
inline

Definition at line 124 of file qcbormap.h.

References item, other(), and Q_ASSERT.

+ Here is the call graph for this function:

◆ operator<=() [1/2]

bool QCborMap::ConstIterator::operator<= ( const ConstIterator other) const
inline

Returns true if the entry in the map pointed to by this iterator occurs before or is the same entry as is pointed to by the other iterator.

Definition at line 131 of file qcbormap.h.

References item, other(), and Q_ASSERT.

+ Here is the call graph for this function:

◆ operator<=() [2/2]

bool QCborMap::ConstIterator::operator<= ( const Iterator other) const
inline

Definition at line 125 of file qcbormap.h.

References item, other(), and Q_ASSERT.

+ Here is the call graph for this function:

◆ operator=()

QCborMap::ConstIterator & QCborMap::ConstIterator::operator= ( const ConstIterator other)
inline

Makes this iterator a copy of other and returns a reference to this iterator.

Definition at line 103 of file qcbormap.h.

References item, and other().

+ Here is the call graph for this function:

◆ operator==() [1/2]

bool QCborMap::ConstIterator::operator== ( const ConstIterator o) const
inline

Definition at line 128 of file qcbormap.h.

References item, and o.

◆ operator==() [2/2]

bool QCborMap::ConstIterator::operator== ( const Iterator other) const
inline

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

See also
operator!=()

Definition at line 122 of file qcbormap.h.

References item, and o.

◆ operator>() [1/2]

bool QCborMap::ConstIterator::operator> ( const ConstIterator other) const
inline

Returns true if the entry in the map pointed to by this iterator occurs after the entry pointed to by the other iterator.

Definition at line 132 of file qcbormap.h.

References item, other(), and Q_ASSERT.

+ Here is the call graph for this function:

◆ operator>() [2/2]

bool QCborMap::ConstIterator::operator> ( const Iterator other) const
inline

Definition at line 126 of file qcbormap.h.

References item, other(), and Q_ASSERT.

+ Here is the call graph for this function:

◆ operator>=() [1/2]

bool QCborMap::ConstIterator::operator>= ( const ConstIterator other) const
inline

Returns true if the entry in the map pointed to by this iterator occurs after or is the same entry as is pointed to by the other iterator.

Definition at line 133 of file qcbormap.h.

References item, other(), and Q_ASSERT.

+ Here is the call graph for this function:

◆ operator>=() [2/2]

bool QCborMap::ConstIterator::operator>= ( const Iterator other) const
inline

Definition at line 127 of file qcbormap.h.

References item, other(), and Q_ASSERT.

+ Here is the call graph for this function:

◆ operator[]()

value_type QCborMap::ConstIterator::operator[] ( qsizetype  j) const
inline

Definition at line 112 of file qcbormap.h.

References j.

◆ value()

QCborValue QCborMap::ConstIterator::value ( ) const
inline

Returns the current item's value.

See also
key(), operator*()

Definition at line 120 of file qcbormap.h.

References item.

Friends And Related Symbol Documentation

◆ Iterator

friend class Iterator
friend

Definition at line 88 of file qcbormap.h.

◆ QCborMap

friend class QCborMap
friend

Definition at line 89 of file qcbormap.h.

◆ QCborValue

friend class QCborValue
friend

Definition at line 90 of file qcbormap.h.

◆ QCborValueRef

friend class QCborValueRef
friend

Definition at line 91 of file qcbormap.h.


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