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
QTaggedIterator< Iterator, IteratorCategory > Class Template Reference

QTaggedIterator is a template class that wraps an iterator and exposes standard iterator traits. More...

#include <qiterable.h>

Inheritance diagram for QTaggedIterator< Iterator, IteratorCategory >:
Collaboration diagram for QTaggedIterator< Iterator, IteratorCategory >:

Public Types

using iterator_category = IteratorCategory
Public Types inherited from Iterator<, int >
using key_type
 Typedef for Key.
using mapped_type
 Typedef for T.
using value_type
using size_type
 Typedef for int.
using difference_type
 Typedef for ptrdiff_t.
using reference
using const_reference
typedef QKeyValueIterator< const QAbstractAnimation *&, const int &, const_iteratorconst_key_value_iterator
 \inmodule QtCore
typedef QKeyValueIterator< const QAbstractAnimation *&, int &, iteratorkey_value_iterator
 \inmodule QtCore
typedef iterator Iterator
 Qt-style synonym for QHash::iterator.
typedef const_iterator ConstIterator
 Qt-style synonym for QHash::const_iterator.

Public Member Functions

 QTaggedIterator (Iterator &&it)
 Constructs a QTaggedIterator from an iterator or QConstIterator it.
bool operator== (const QTaggedIterator &o) const
 Returns true if other points to the same item as this iterator; otherwise returns false.
bool operator!= (const QTaggedIterator &o) const
 Returns true if other points to a different item than this iterator; otherwise returns false.
QTaggedIteratoroperator++ ()
 The prefix {++} operator ({++it}) advances the iterator to the next item in the container and returns an iterator to the new current item.
QTaggedIterator operator++ (int x)
 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.
QTaggedIteratoroperator-- ()
 The prefix {–} operator ({–it}) makes the preceding item current and returns an iterator to the new current item.
QTaggedIterator operator-- (int x)
 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.
QTaggedIteratoroperator+= (qsizetype j)
 Advances the iterator by j items.
QTaggedIteratoroperator-= (qsizetype j)
 Makes the iterator go back by j items.
QTaggedIterator operator+ (qsizetype j) const
 Returns an iterator to the item at j positions forward from this iterator.
QTaggedIterator operator- (qsizetype j) const
 Returns an iterator to the item at j positions backward from this iterator.
qsizetype operator- (const QTaggedIterator &j) const
bool operator< (const QTaggedIterator &j)
bool operator>= (const QTaggedIterator &j)
bool operator> (const QTaggedIterator &j)
bool operator<= (const QTaggedIterator &j)
Public Member Functions inherited from Iterator<, int >
 QHash () noexcept=default
 Constructs an empty hash.
 QHash (std::initializer_list< std::pair< QAbstractAnimation *, int > > list)
 QHash (const QHash &other) noexcept
 Constructs a copy of other.
 ~QHash ()
 Destroys the hash.
QHashoperator= (const QHash &other) noexcept(std::is_nothrow_destructible< Node >::value)
 Assigns other to this hash and returns a reference to this hash.
 QHash (QHash &&other) noexcept
 Move-constructs a QHash instance, making it point at the same object that other was pointing to.
 QHash (InputIterator f, InputIterator l)
 QHash (InputIterator f, InputIterator l)
void swap (QHash &other) noexcept
qsizetype removeIf (Predicate pred)
int take (const QAbstractAnimation *&key)
 Removes the item with the key from the hash and returns the value associated with it.
bool contains (const QAbstractAnimation *&key) const noexcept
 Returns true if the hash contains an item with the key; otherwise returns false.
qsizetype count (const QAbstractAnimation *&key) const noexcept
 Returns the number of items associated with the key.
QAbstractAnimationkey (const int &value) const noexcept
QAbstractAnimationkey (const int &value, const QAbstractAnimation *&defaultKey) const noexcept
int value (const QAbstractAnimation *&key) const noexcept
int value (const QAbstractAnimation *&key, const int &defaultValue) const noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the value associated with the key.
int & operator[] (const QAbstractAnimation *&key)
 Returns the value associated with the key as a modifiable reference.
const int operator[] (const QAbstractAnimation *&key) const noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as value().
QList< QAbstractAnimation * > keys () const
 Returns a list containing all the keys in the hash, in an arbitrary order.
QList< QAbstractAnimation * > keys (const int &value) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a list containing all the keys associated with value value, in an arbitrary order.
QList< int > values () const
 Returns a list containing all the values in the hash, in an arbitrary order.
iterator begin ()
 Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
const_iterator begin () const noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const_iterator cbegin () const noexcept
const_iterator constBegin () const noexcept
 Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
iterator end () noexcept
 Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last item in the hash.
const_iterator end () const noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const_iterator cend () const noexcept
const_iterator constEnd () const noexcept
 Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last item in the hash.
key_iterator keyBegin () const noexcept
key_iterator keyEnd () const noexcept
key_value_iterator keyValueBegin ()
key_value_iterator keyValueEnd ()
const_key_value_iterator keyValueBegin () const noexcept
const_key_value_iterator constKeyValueBegin () const noexcept
const_key_value_iterator keyValueEnd () const noexcept
const_key_value_iterator constKeyValueEnd () const noexcept
auto asKeyValueRange () &
auto asKeyValueRange () const &
auto asKeyValueRange () &&
auto asKeyValueRange () const &&
iterator erase (const_iterator it)
std::pair< iterator, iteratorequal_range (const QAbstractAnimation *&key)
std::pair< const_iterator, const_iteratorequal_range (const QAbstractAnimation *&key) const noexcept
qsizetype count () const noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as size().
iterator find (const QAbstractAnimation *&key)
 Returns an iterator pointing to the item with the key in the hash.
const_iterator find (const QAbstractAnimation *&key) const noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const_iterator constFind (const QAbstractAnimation *&key) const noexcept
iterator insert (const QAbstractAnimation *&key, const int &value)
 Inserts a new item with the key and a value of value.
void insert (const QHash &hash)
iterator emplace (const QAbstractAnimation *&key, Args &&... args)
iterator emplace (QAbstractAnimation *&&key, Args &&... args)
 Inserts a new element into the container.
TryEmplaceResult tryEmplace (const QAbstractAnimation *&key, Args &&...args)
 \variable QHash::TryEmplaceResult::iterator
TryEmplaceResult tryEmplace (QAbstractAnimation *&&key, Args &&...args)
TryEmplaceResult tryInsert (const QAbstractAnimation *&key, const int &value)
std::pair< key_value_iterator, bool > try_emplace (const QAbstractAnimation *&key, Args &&...args)
std::pair< key_value_iterator, bool > try_emplace (QAbstractAnimation *&&key, Args &&...args)
key_value_iterator try_emplace (const_iterator, const QAbstractAnimation *&key, Args &&...args)
key_value_iterator try_emplace (const_iterator, QAbstractAnimation *&&key, Args &&...args)
TryEmplaceResult insertOrAssign (const QAbstractAnimation *&key, Value &&value)
TryEmplaceResult insertOrAssign (QAbstractAnimation *&&key, Value &&value)
std::pair< key_value_iterator, bool > insert_or_assign (const QAbstractAnimation *&key, Value &&value)
std::pair< key_value_iterator, bool > insert_or_assign (QAbstractAnimation *&&key, Value &&value)
key_value_iterator insert_or_assign (const_iterator, const QAbstractAnimation *&key, Value &&value)
key_value_iterator insert_or_assign (const_iterator, QAbstractAnimation *&&key, Value &&value)
float load_factor () const noexcept
 Returns the current load factor of the QHash's internal hash table.
size_t bucket_count () const noexcept
bool empty () const noexcept
 This function is provided for STL compatibility.
bool remove (const K &key)
int take (const K &key)
bool contains (const K &key) const
qsizetype count (const K &key) const
int value (const K &key) const noexcept
int value (const K &key, const int &defaultValue) const noexcept
int & operator[] (const K &key)
const int operator[] (const K &key) const noexcept
std::pair< iterator, iteratorequal_range (const K &key)
std::pair< const_iterator, const_iteratorequal_range (const K &key) const noexcept
iterator find (const K &key)
const_iterator find (const K &key) const noexcept
const_iterator constFind (const K &key) const noexcept
TryEmplaceResult tryEmplace (K &&key, Args &&...args)
TryEmplaceResult tryInsert (K &&key, const int &value)
std::pair< key_value_iterator, bool > try_emplace (K &&key, Args &&...args)
key_value_iterator try_emplace (const_iterator, K &&key, Args &&...args)
TryEmplaceResult insertOrAssign (K &&key, Value &&value)
std::pair< key_value_iterator, bool > insert_or_assign (K &&key, Value &&value)
key_value_iterator insert_or_assign (const_iterator, K &&key, Value &&value)

Friends

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

Additional Inherited Members

Static Public Member Functions inherited from Iterator<, int >
static float max_load_factor () noexcept
static size_t max_bucket_count () noexcept

Detailed Description

template<class Iterator, typename IteratorCategory>
class QTaggedIterator< Iterator, IteratorCategory >

QTaggedIterator is a template class that wraps an iterator and exposes standard iterator traits.

Since
6.0 \inmodule QtCore

In order to use an iterator any of the standard algorithms, its iterator traits need to be known. As QSequentialIterable can work with many different kinds of containers, we cannot declare the traits in the iterator classes themselves. A QTaggedIterator gives you a way to explicitly declare a trait for a concrete instance of an iterator or QConstIterator.

Definition at line 70 of file qiterable.h.

Member Typedef Documentation

◆ iterator_category

template<class Iterator, typename IteratorCategory>
using QTaggedIterator< Iterator, IteratorCategory >::iterator_category = IteratorCategory

Definition at line 73 of file qiterable.h.

Constructor & Destructor Documentation

◆ QTaggedIterator()

template<class Iterator, typename IteratorCategory>
QTaggedIterator< Iterator, IteratorCategory >::QTaggedIterator ( Iterator && it)
inline

Constructs a QTaggedIterator from an iterator or QConstIterator it.

Checks whether the IteratorCategory passed as template argument matches the run time capabilities of it; if there's no match, it is refused.

Definition at line 74 of file qiterable.h.

Referenced by QTaggedIterator< QAssociativeIterator, void >::QTaggedIterator().

Here is the caller graph for this function:

Member Function Documentation

◆ operator!=()

template<class Iterator, typename IteratorCategory>
bool QTaggedIterator< Iterator, IteratorCategory >::operator!= ( const QTaggedIterator< Iterator, IteratorCategory > & o) const
inline

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

See also
operator==()

Definition at line 109 of file qiterable.h.

◆ operator+()

template<class Iterator, typename IteratorCategory>
QTaggedIterator QTaggedIterator< Iterator, IteratorCategory >::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 116 of file qiterable.h.

◆ operator++() [1/2]

template<class Iterator, typename IteratorCategory>
QTaggedIterator & QTaggedIterator< Iterator, IteratorCategory >::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 110 of file qiterable.h.

◆ operator++() [2/2]

template<class Iterator, typename IteratorCategory>
QTaggedIterator QTaggedIterator< Iterator, IteratorCategory >::operator++ ( int x)
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 111 of file qiterable.h.

◆ operator+=()

template<class Iterator, typename IteratorCategory>
QTaggedIterator & QTaggedIterator< Iterator, IteratorCategory >::operator+= ( qsizetype j)
inline

Advances the iterator by j items.

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

Definition at line 114 of file qiterable.h.

◆ operator-() [1/2]

template<class Iterator, typename IteratorCategory>
qsizetype QTaggedIterator< Iterator, IteratorCategory >::operator- ( const QTaggedIterator< Iterator, IteratorCategory > & j) const
inline

Definition at line 118 of file qiterable.h.

◆ operator-() [2/2]

template<class Iterator, typename IteratorCategory>
QTaggedIterator QTaggedIterator< Iterator, IteratorCategory >::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 117 of file qiterable.h.

◆ operator--() [1/2]

template<class Iterator, typename IteratorCategory>
QTaggedIterator & QTaggedIterator< Iterator, IteratorCategory >::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 112 of file qiterable.h.

◆ operator--() [2/2]

template<class Iterator, typename IteratorCategory>
QTaggedIterator QTaggedIterator< Iterator, IteratorCategory >::operator-- ( int x)
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 113 of file qiterable.h.

◆ operator-=()

template<class Iterator, typename IteratorCategory>
QTaggedIterator & QTaggedIterator< Iterator, IteratorCategory >::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 115 of file qiterable.h.

◆ operator<()

template<class Iterator, typename IteratorCategory>
bool QTaggedIterator< Iterator, IteratorCategory >::operator< ( const QTaggedIterator< Iterator, IteratorCategory > & j)
inline

Definition at line 120 of file qiterable.h.

Referenced by QTaggedIterator< QAssociativeIterator, void >::operator>=().

Here is the caller graph for this function:

◆ operator<=()

template<class Iterator, typename IteratorCategory>
bool QTaggedIterator< Iterator, IteratorCategory >::operator<= ( const QTaggedIterator< Iterator, IteratorCategory > & j)
inline

Definition at line 123 of file qiterable.h.

◆ operator==()

template<class Iterator, typename IteratorCategory>
bool QTaggedIterator< Iterator, IteratorCategory >::operator== ( const QTaggedIterator< Iterator, IteratorCategory > & o) const
inline

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

See also
operator!=()

Definition at line 108 of file qiterable.h.

◆ operator>()

template<class Iterator, typename IteratorCategory>
bool QTaggedIterator< Iterator, IteratorCategory >::operator> ( const QTaggedIterator< Iterator, IteratorCategory > & j)
inline

Definition at line 122 of file qiterable.h.

Referenced by QTaggedIterator< QAssociativeIterator, void >::operator<=().

Here is the caller graph for this function:

◆ operator>=()

template<class Iterator, typename IteratorCategory>
bool QTaggedIterator< Iterator, IteratorCategory >::operator>= ( const QTaggedIterator< Iterator, IteratorCategory > & j)
inline

Definition at line 121 of file qiterable.h.

◆ operator+

template<class Iterator, typename IteratorCategory>
QTaggedIterator operator+ ( qsizetype j,
const QTaggedIterator< Iterator, IteratorCategory > & k )
friend

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

Definition at line 125 of file qiterable.h.


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