QtBase  v6.3.1
Public Types | Public Member Functions | List of all members
QAssociativeIterable Class Reference

The QAssociativeIterable class is an iterable interface for an associative container in a QVariant. More...

#include <qassociativeiterable.h>

Inheritance diagram for QAssociativeIterable:
Inheritance graph
[legend]
Collaboration diagram for QAssociativeIterable:
Collaboration graph
[legend]

Public Types

using iterator = QTaggedIterator< QAssociativeIterator, void >
 
using const_iterator = QTaggedIterator< QAssociativeConstIterator, void >
 
using RandomAccessIterator = QTaggedIterator< iterator, std::random_access_iterator_tag >
 
using BidirectionalIterator = QTaggedIterator< iterator, std::bidirectional_iterator_tag >
 
using ForwardIterator = QTaggedIterator< iterator, std::forward_iterator_tag >
 
using InputIterator = QTaggedIterator< iterator, std::input_iterator_tag >
 
using RandomAccessConstIterator = QTaggedIterator< const_iterator, std::random_access_iterator_tag >
 
using BidirectionalConstIterator = QTaggedIterator< const_iterator, std::bidirectional_iterator_tag >
 
using ForwardConstIterator = QTaggedIterator< const_iterator, std::forward_iterator_tag >
 
using InputConstIterator = QTaggedIterator< const_iterator, std::input_iterator_tag >
 

Public Member Functions

template<class T >
 QAssociativeIterable (const T *p)
 
template<class T >
 QAssociativeIterable (T *p)
 
 QAssociativeIterable ()
 
template<typename Pointer >
 QAssociativeIterable (const QMetaAssociation &metaAssociation, Pointer iterable)
 
 QAssociativeIterable (const QMetaAssociation &metaAssociation, const QMetaType &metaType, void *iterable)
 
 QAssociativeIterable (const QMetaAssociation &metaAssociation, const QMetaType &metaType, const void *iterable)
 
 QAssociativeIterable (QIterable< QMetaAssociation > &&other)
 
QAssociativeIterableoperator= (QIterable< QMetaAssociation > &&other)
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator constBegin () const
 
const_iterator constEnd () const
 
iterator mutableBegin ()
 
iterator mutableEnd ()
 
const_iterator find (const QVariant &key) const
 
const_iterator constFind (const QVariant &key) const
 
iterator mutableFind (const QVariant &key)
 
bool containsKey (const QVariant &key)
 
void insertKey (const QVariant &key)
 
void removeKey (const QVariant &key)
 
QVariant value (const QVariant &key) const
 
void setValue (const QVariant &key, const QVariant &mapped)
 
- Public Member Functions inherited from QIterable< QMetaAssociation >
 QIterable (const QMetaAssociation &metaContainer, const T *p)
 
 QIterable (const QMetaAssociation &metaContainer, T *p)
 
 QIterable (const QMetaAssociation &metaContainer, Pointer iterable)
 
 QIterable (const QMetaAssociation &metaContainer, qsizetype alignment, const void *p)
 
 QIterable (const QMetaAssociation &metaContainer, qsizetype alignment, void *p)
 
bool canInputIterate () const
 
bool canForwardIterate () const
 
bool canReverseIterate () const
 
bool canRandomAccessIterate () const
 
const voidconstIterable () const
 
voidmutableIterable ()
 
QConstIterator< QMetaAssociationconstBegin () const
 
QConstIterator< QMetaAssociationconstEnd () const
 
QIterator< QMetaAssociationmutableBegin ()
 
QIterator< QMetaAssociationmutableEnd ()
 
qsizetype size () const
 
QMetaAssociation metaContainer () const
 

Additional Inherited Members

- Protected Attributes inherited from QIterable< QMetaAssociation >
uint m_revision
 
QtPrivate::QConstPreservingPointer< void, quint16m_iterable
 
QMetaAssociation m_metaContainer
 

Detailed Description

The QAssociativeIterable class is an iterable interface for an associative container in a QVariant.

Since
5.2 \inmodule QtCore

This class allows several methods of accessing the elements of an associative container held within a QVariant. An instance of QAssociativeIterable can be extracted from a QVariant if it can be converted to a QVariantHash or QVariantMap or if a custom mutable view has been registered.

The container itself is not copied before iterating over it.

See also
QVariant

Definition at line 86 of file qassociativeiterable.h.

Member Typedef Documentation

◆ BidirectionalConstIterator

Exposes a const_iterator using std::bidirectional_iterator_tag.

Definition at line 98 of file qassociativeiterable.h.

◆ BidirectionalIterator

Exposes an iterator using std::bidirectional_iterator_tag.

Definition at line 93 of file qassociativeiterable.h.

◆ const_iterator

Definition at line 90 of file qassociativeiterable.h.

◆ ForwardConstIterator

Exposes a const_iterator using std::forward_iterator_tag.

Definition at line 99 of file qassociativeiterable.h.

◆ ForwardIterator

Exposes an iterator using std::forward_iterator_tag.

Definition at line 94 of file qassociativeiterable.h.

◆ InputConstIterator

Exposes a const_iterator using std::input_iterator_tag.

Definition at line 100 of file qassociativeiterable.h.

◆ InputIterator

Exposes an iterator using std::input_iterator_tag.

Definition at line 95 of file qassociativeiterable.h.

◆ iterator

Definition at line 89 of file qassociativeiterable.h.

◆ RandomAccessConstIterator

Exposes a const_iterator using std::random_access_iterator_tag.

Definition at line 97 of file qassociativeiterable.h.

◆ RandomAccessIterator

Exposes an iterator using std::random_access_iterator_tag.

Definition at line 92 of file qassociativeiterable.h.

Constructor & Destructor Documentation

◆ QAssociativeIterable() [1/7]

template<class T >
QAssociativeIterable::QAssociativeIterable ( const T p)
inline

Definition at line 103 of file qassociativeiterable.h.

◆ QAssociativeIterable() [2/7]

template<class T >
QAssociativeIterable::QAssociativeIterable ( T p)
inline

Definition at line 109 of file qassociativeiterable.h.

◆ QAssociativeIterable() [3/7]

QAssociativeIterable::QAssociativeIterable ( )
inline

Definition at line 114 of file qassociativeiterable.h.

◆ QAssociativeIterable() [4/7]

template<typename Pointer >
QAssociativeIterable::QAssociativeIterable ( const QMetaAssociation metaAssociation,
Pointer  iterable 
)
inline

Definition at line 120 of file qassociativeiterable.h.

◆ QAssociativeIterable() [5/7]

QAssociativeIterable::QAssociativeIterable ( const QMetaAssociation metaAssociation,
const QMetaType metaType,
void iterable 
)
inline

Definition at line 126 of file qassociativeiterable.h.

◆ QAssociativeIterable() [6/7]

QAssociativeIterable::QAssociativeIterable ( const QMetaAssociation metaAssociation,
const QMetaType metaType,
const void iterable 
)
inline

Definition at line 133 of file qassociativeiterable.h.

◆ QAssociativeIterable() [7/7]

QAssociativeIterable::QAssociativeIterable ( QIterable< QMetaAssociation > &&  other)
inline

Definition at line 139 of file qassociativeiterable.h.

Member Function Documentation

◆ begin()

const_iterator QAssociativeIterable::begin ( ) const
inline

Definition at line 147 of file qassociativeiterable.h.

Here is the caller graph for this function:

◆ constBegin()

const_iterator QAssociativeIterable::constBegin ( ) const
inline

Definition at line 150 of file qassociativeiterable.h.

Here is the call graph for this function:

◆ constEnd()

const_iterator QAssociativeIterable::constEnd ( ) const
inline

Definition at line 151 of file qassociativeiterable.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ constFind()

const_iterator QAssociativeIterable::constFind ( const QVariant key) const
inline

Definition at line 157 of file qassociativeiterable.h.

Here is the call graph for this function:

◆ containsKey()

bool QAssociativeIterable::containsKey ( const QVariant key)

Returns true if the container has an entry with the given key, or false otherwise. If the key isn't convertible to the expected type, false is returned.

Definition at line 223 of file qassociativeiterable.cpp.

Here is the call graph for this function:

◆ end()

const_iterator QAssociativeIterable::end ( ) const
inline

Definition at line 148 of file qassociativeiterable.h.

Here is the caller graph for this function:

◆ find()

QAssociativeIterable::const_iterator QAssociativeIterable::find ( const QVariant key) const

Retrieves a const_iterator pointing to the element at the given key, or the end of the container if that key does not exist. If the key isn't convertible to the expected type, the end of the container is returned.

Definition at line 193 of file qassociativeiterable.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertKey()

void QAssociativeIterable::insertKey ( const QVariant key)

Inserts a new entry with the given key, or resets the mapped value of any existing entry with the given key to the default constructed mapped value. The key is coerced to the expected type: If it isn't convertible, a default value is inserted.

Definition at line 238 of file qassociativeiterable.cpp.

Here is the call graph for this function:

◆ mutableBegin()

iterator QAssociativeIterable::mutableBegin ( )
inline

Definition at line 153 of file qassociativeiterable.h.

Here is the call graph for this function:

◆ mutableEnd()

iterator QAssociativeIterable::mutableEnd ( )
inline

Definition at line 154 of file qassociativeiterable.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mutableFind()

QAssociativeIterable::iterator QAssociativeIterable::mutableFind ( const QVariant key)

Retrieves an iterator pointing to the element at the given key, or the end of the container if that key does not exist. If the key isn't convertible to the expected type, the end of the container is returned.

Definition at line 209 of file qassociativeiterable.cpp.

Here is the call graph for this function:

◆ operator=()

QAssociativeIterable& QAssociativeIterable::operator= ( QIterable< QMetaAssociation > &&  other)
inline

Definition at line 141 of file qassociativeiterable.h.

Here is the call graph for this function:

◆ removeKey()

void QAssociativeIterable::removeKey ( const QVariant key)

Removes the entry with the given key from the container. The key is coerced to the expected type: If it isn't convertible, the default value is removed.

Definition at line 250 of file qassociativeiterable.cpp.

Here is the call graph for this function:

◆ setValue()

void QAssociativeIterable::setValue ( const QVariant key,
const QVariant mapped 
)

Sets the mapped value associated with key to mapped, if possible. Inserts a new entry if none exists yet, for the given key. If the key is not convertible to the key type, the value for the default-constructed key type is overwritten.

Definition at line 289 of file qassociativeiterable.cpp.

Here is the call graph for this function:

◆ value()

QVariant QAssociativeIterable::value ( const QVariant key) const

Retrieves the mapped value at the given key, or a default-constructed QVariant of the mapped type, if the key does not exist. If the key is not convertible to the key type, the mapped value associated with the default-constructed key is returned.

Definition at line 264 of file qassociativeiterable.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

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