ConstIterator 類

class QCborMap ::ConstIterator

The QCborMap::ConstIterator 類提供 STL 樣式 const 迭代器為 QCborMap . 更多...

該類在 Qt 5.12 引入。

公共類型

typedef iterator_category

公共函數

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

詳細描述

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

另請參閱 QCborMap::Iterator .

成員類型文檔編製

typedef ConstIterator:: iterator_category

同義詞 std::random_access_iterator_tag indicating this iterator is a random-access iterator.

成員函數文檔編製

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

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

返迴 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.

bool ConstIterator:: operator> (const ConstIterator & other ) const

bool ConstIterator:: operator> (const Iterator & other ) const

返迴 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 ConstIterator & other ) const

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

返迴 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 ConstIterator & other ) const

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

返迴 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 ConstIterator & other ) const

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

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

另請參閱 operator== ().

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

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

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

另請參閱 operator!= ().

ConstIterator:: ConstIterator (const ConstIterator & other )

Constructs an iterator as a copy of other .

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.

另請參閱 QCborMap::constBegin () 和 QCborMap::constEnd ().

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

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

QCborValue ConstIterator:: key () const

Returns the current item's key.

另請參閱 value ().

QCborValueRef ConstIterator:: value () const

Returns the current item's value.

另請參閱 key () 和 operator* ().

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

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

另請參閱 key () 和 value ().

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.

另請參閱 operator- ().

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.

另請參閱 operator-- ().

ConstIterator ConstIterator:: operator++ ( int )

這是重載函數。

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

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

推進迭代器 j items. If j is negative, the iterator goes backward. Returns a reference to this iterator.

另請參閱 operator-= () 和 operator+ ().

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.

另請參閱 operator+ ().

qsizetype ConstIterator:: operator- ( 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.

另請參閱 operator+ ().

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.

另請參閱 operator++ ().

ConstIterator ConstIterator:: operator-- ( int )

這是重載函數。

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

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.

另請參閱 operator+= () 和 operator- ().

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

Returns a pointer to the current pair's value.