ConstIterator Class

class QCborMap::ConstIterator

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

Public Types

Public Functions

ConstIterator()
ConstIterator(const QCborMap::ConstIterator &other)
QCborValue key() const
QCborValueConstRef value() const
bool operator!=(const QCborMap::Iterator &other) const
bool operator!=(const QCborMap::ConstIterator &other) const
QCborMap::ConstIterator::value_type operator*() const
QCborMap::ConstIterator operator+(qsizetype j) const
QCborMap::ConstIterator &operator++()
QCborMap::ConstIterator operator++(int)
QCborMap::ConstIterator &operator+=(qsizetype j)
QCborMap::ConstIterator operator-(qsizetype j) const
qsizetype operator-(QCborMap::ConstIterator j) const
QCborMap::ConstIterator &operator--()
QCborMap::ConstIterator operator--(int)
QCborMap::ConstIterator &operator-=(qsizetype j)
const QCborValueConstRef *operator->() const
bool operator<(const QCborMap::Iterator &other) const
bool operator<(const QCborMap::ConstIterator &other) const
bool operator<=(const QCborMap::Iterator &other) const
bool operator<=(const QCborMap::ConstIterator &other) const
QCborMap::ConstIterator &operator=(const QCborMap::ConstIterator &other)
bool operator==(const QCborMap::Iterator &other) const
bool operator==(const QCborMap::ConstIterator &other) const
bool operator>(const QCborMap::Iterator &other) const
bool operator>(const QCborMap::ConstIterator &other) const
bool operator>=(const QCborMap::Iterator &other) const
bool operator>=(const QCborMap::ConstIterator &other) const

Detailed Description

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.

Member Type Documentation

ConstIterator::iterator_category

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

Member Function Documentation

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

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

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

See also operator!=().

bool ConstIterator::operator!=(const QCborMap::ConstIterator &other) const

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

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

See also operator==().

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

bool ConstIterator::operator<(const QCborMap::Iterator &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 ConstIterator::operator<=(const QCborMap::ConstIterator &other) const

bool ConstIterator::operator<=(const QCborMap::Iterator &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 ConstIterator::operator>(const QCborMap::ConstIterator &other) const

bool ConstIterator::operator>(const QCborMap::Iterator &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 ConstIterator::operator>=(const QCborMap::ConstIterator &other) const

bool ConstIterator::operator>=(const QCborMap::Iterator &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.

[constexpr noexcept] ConstIterator::ConstIterator()

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() and QCborMap::constEnd().

[constexpr noexcept] ConstIterator::ConstIterator(const QCborMap::ConstIterator &other)

Constructs an iterator as a copy of other.

QCborValue ConstIterator::key() const

Returns the current item's key.

See also value().

QCborValueConstRef ConstIterator::value() const

Returns the current item's value.

See also key() and operator*().

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

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

See also key() and value().

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

Returns an iterator to the item at j positions forward from this iterator. If j is negative, the iterator goes backward.

See also operator-().

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

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--().

QCborMap::ConstIterator ConstIterator::operator++(int)

This is an overloaded function.

The postfix ++ operator, i++, advances the iterator to the next item in the map and returns an iterator to the previously current item.

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

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

See also operator-=() and operator+().

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

Returns an iterator to the item at j positions backward from this iterator. If j is negative, the iterator goes forward.

See also operator+().

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

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+().

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

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++().

QCborMap::ConstIterator ConstIterator::operator--(int)

This is an overloaded function.

The postfix -- operator, i--, makes the preceding item current and returns an iterator pointing to the previously current item.

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

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+=() and operator-().

const QCborValueConstRef *ConstIterator::operator->() const

Returns a pointer to the current pair's value.

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

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

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.