![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QAssociativeIterable class is an iterable interface for an associative container in a QVariant. More...
#include <qassociativeiterable.h>
Public Types | |
using | iterator = QTaggedIterator<QAssociativeIterator, void> |
using | const_iterator = QTaggedIterator<QAssociativeConstIterator, void> |
using | RandomAccessIterator = QTaggedIterator<iterator, std::random_access_iterator_tag> |
Exposes an iterator using std::random_access_iterator_tag. | |
using | BidirectionalIterator = QTaggedIterator<iterator, std::bidirectional_iterator_tag> |
Exposes an iterator using std::bidirectional_iterator_tag. | |
using | ForwardIterator = QTaggedIterator<iterator, std::forward_iterator_tag> |
Exposes an iterator using std::forward_iterator_tag. | |
using | InputIterator = QTaggedIterator<iterator, std::input_iterator_tag> |
Exposes an iterator using std::input_iterator_tag. | |
using | RandomAccessConstIterator = QTaggedIterator<const_iterator, std::random_access_iterator_tag> |
Exposes a const_iterator using std::random_access_iterator_tag. | |
using | BidirectionalConstIterator = QTaggedIterator<const_iterator, std::bidirectional_iterator_tag> |
Exposes a const_iterator using std::bidirectional_iterator_tag. | |
using | ForwardConstIterator = QTaggedIterator<const_iterator, std::forward_iterator_tag> |
Exposes a const_iterator using std::forward_iterator_tag. | |
using | InputConstIterator = QTaggedIterator<const_iterator, std::input_iterator_tag> |
Exposes a const_iterator using 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) | |
QAssociativeIterable & | operator= (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 |
Retrieves a const_iterator pointing to the element at the given key, or the end of the container if that key does not exist. | |
const_iterator | constFind (const QVariant &key) const |
iterator | 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. | |
bool | containsKey (const QVariant &key) |
Returns true if the container has an entry with the given key, or false otherwise. | |
void | 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. | |
void | removeKey (const QVariant &key) |
Removes the entry with the given key from the container. | |
QVariant | 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. | |
void | setValue (const QVariant &key, const QVariant &mapped) |
Sets the mapped value associated with key to mapped, if possible. | |
![]() | |
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 |
Returns whether the container has an input iterator. | |
bool | canForwardIterate () const |
Returns whether it is possible to iterate over the container in forward direction. | |
bool | canReverseIterate () const |
Returns whether it is possible to iterate over the container in reverse. | |
bool | canRandomAccessIterate () const |
Returns whether it is possible to efficiently skip over multiple values using and iterator. | |
const void * | constIterable () const |
void * | mutableIterable () |
QConstIterator< QMetaAssociation > | constBegin () const |
Returns a QConstIterator for the beginning of the container. | |
QConstIterator< QMetaAssociation > | constEnd () const |
Returns a Qterable::QConstIterator for the end of the container. | |
QIterator< QMetaAssociation > | mutableBegin () |
Returns a QIterator for the beginning of the container. | |
QIterator< QMetaAssociation > | mutableEnd () |
Returns a QSequentialIterable::iterator for the end of the container. | |
qsizetype | size () const |
Returns the number of values in the container. | |
QMetaAssociation | metaContainer () const |
Additional Inherited Members | |
![]() | |
uint | m_revision |
QtPrivate::QConstPreservingPointer< void, quint16 > | m_iterable |
QMetaAssociation | m_metaContainer |
The QAssociativeIterable class is an iterable interface for an associative container in a QVariant.
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.
Definition at line 50 of file qassociativeiterable.h.
using QAssociativeIterable::BidirectionalConstIterator = QTaggedIterator<const_iterator, std::bidirectional_iterator_tag> |
Exposes a const_iterator using std::bidirectional_iterator_tag.
Definition at line 62 of file qassociativeiterable.h.
using QAssociativeIterable::BidirectionalIterator = QTaggedIterator<iterator, std::bidirectional_iterator_tag> |
Exposes an iterator using std::bidirectional_iterator_tag.
Definition at line 57 of file qassociativeiterable.h.
Definition at line 54 of file qassociativeiterable.h.
using QAssociativeIterable::ForwardConstIterator = QTaggedIterator<const_iterator, std::forward_iterator_tag> |
Exposes a const_iterator using std::forward_iterator_tag.
Definition at line 63 of file qassociativeiterable.h.
using QAssociativeIterable::ForwardIterator = QTaggedIterator<iterator, std::forward_iterator_tag> |
Exposes an iterator using std::forward_iterator_tag.
Definition at line 58 of file qassociativeiterable.h.
using QAssociativeIterable::InputConstIterator = QTaggedIterator<const_iterator, std::input_iterator_tag> |
Exposes a const_iterator using std::input_iterator_tag.
Definition at line 64 of file qassociativeiterable.h.
using QAssociativeIterable::InputIterator = QTaggedIterator<iterator, std::input_iterator_tag> |
Exposes an iterator using std::input_iterator_tag.
Definition at line 59 of file qassociativeiterable.h.
Definition at line 53 of file qassociativeiterable.h.
using QAssociativeIterable::RandomAccessConstIterator = QTaggedIterator<const_iterator, std::random_access_iterator_tag> |
Exposes a const_iterator using std::random_access_iterator_tag.
Definition at line 61 of file qassociativeiterable.h.
using QAssociativeIterable::RandomAccessIterator = QTaggedIterator<iterator, std::random_access_iterator_tag> |
Exposes an iterator using std::random_access_iterator_tag.
Definition at line 56 of file qassociativeiterable.h.
|
inline |
Definition at line 67 of file qassociativeiterable.h.
|
inline |
Definition at line 73 of file qassociativeiterable.h.
|
inline |
Definition at line 78 of file qassociativeiterable.h.
|
inline |
Definition at line 84 of file qassociativeiterable.h.
|
inline |
Definition at line 90 of file qassociativeiterable.h.
|
inline |
Definition at line 97 of file qassociativeiterable.h.
|
inline |
Definition at line 103 of file qassociativeiterable.h.
|
inline |
Definition at line 111 of file qassociativeiterable.h.
|
inline |
Definition at line 114 of file qassociativeiterable.h.
|
inline |
Definition at line 115 of file qassociativeiterable.h.
|
inline |
Definition at line 121 of file qassociativeiterable.h.
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 187 of file qassociativeiterable.cpp.
|
inline |
Definition at line 112 of file qassociativeiterable.h.
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 157 of file qassociativeiterable.cpp.
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 202 of file qassociativeiterable.cpp.
|
inline |
Definition at line 117 of file qassociativeiterable.h.
|
inline |
Definition at line 118 of file qassociativeiterable.h.
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 173 of file qassociativeiterable.cpp.
|
inline |
Definition at line 105 of file qassociativeiterable.h.
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 214 of file qassociativeiterable.cpp.
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 253 of file qassociativeiterable.cpp.
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 228 of file qassociativeiterable.cpp.