![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtCore More...
#include <qmetacontainer.h>
Public Member Functions | |
| QMetaAssociation ()=default | |
| QMetaAssociation (const QtMetaContainerPrivate::QMetaAssociationInterface *d) | |
| QMetaType | keyMetaType () const |
| Returns the meta type for keys in the container. | |
| QMetaType | mappedMetaType () const |
| Returns the meta type for mapped values in the container. | |
| bool | canInsertKey () const |
Returns true if keys can be added to the container using \l insertKey(), otherwise returns false. | |
| void | insertKey (void *container, const void *key) const |
| Inserts the key into the container if possible. | |
| bool | canRemoveKey () const |
Returns true if keys can be removed from the container using \l removeKey(), otherwise returns false. | |
| void | removeKey (void *container, const void *key) const |
| Removes the key and its associated mapped value from the container if possible. | |
| bool | canContainsKey () const |
Returns true if the container can be queried for keys using \l containsKey(), otherwise returns false. | |
| bool | containsKey (const void *container, const void *key) const |
Returns true if the container can be queried for keys and contains the key, otherwise returns false. | |
| bool | canGetMappedAtKey () const |
Returns true if the container can be queried for values using \l mappedAtKey(), otherwise returns false. | |
| void | mappedAtKey (const void *container, const void *key, void *mapped) const |
| Retrieves the mapped value associated with the key in the container and places it in the memory location pointed to by mapped, if that is possible. | |
| bool | canSetMappedAtKey () const |
Returns true if mapped values can be modified in the container using \l setMappedAtKey(), otherwise returns false. | |
| void | setMappedAtKey (void *container, const void *key, const void *mapped) const |
| Overwrites the value associated with the key in the container using the mapped value passed as argument if that is possible. | |
| bool | canGetKeyAtIterator () const |
Returns true if a key can be retrieved from a non-const iterator using \l keyAtIterator(), otherwise returns false. | |
| void | keyAtIterator (const void *iterator, void *key) const |
| Retrieves the key pointed to by the non-const iterator and stores it in the memory location pointed to by key, if possible. | |
| bool | canGetKeyAtConstIterator () const |
Returns true if a key can be retrieved from a const iterator using \l keyAtConstIterator(), otherwise returns false. | |
| void | keyAtConstIterator (const void *iterator, void *key) const |
| Retrieves the key pointed to by the const iterator and stores it in the memory location pointed to by key, if possible. | |
| bool | canGetMappedAtIterator () const |
Returns true if a mapped value can be retrieved from a non-const iterator using \l mappedAtIterator(), otherwise returns false. | |
| void | mappedAtIterator (const void *iterator, void *mapped) const |
| Retrieves the mapped value pointed to by the non-const iterator and stores it in the memory location pointed to by mapped, if possible. | |
| bool | canGetMappedAtConstIterator () const |
Returns true if a mapped value can be retrieved from a const iterator using \l mappedAtConstIterator(), otherwise returns false. | |
| void | mappedAtConstIterator (const void *iterator, void *mapped) const |
| Retrieves the mapped value pointed to by the const iterator and stores it in the memory location pointed to by mapped, if possible. | |
| bool | canSetMappedAtIterator () const |
Returns true if a mapped value can be set via a non-const iterator using \l setMappedAtIterator(), otherwise returns false. | |
| void | setMappedAtIterator (const void *iterator, const void *mapped) const |
| Writes the mapped value to the container location pointed to by the non-const iterator, if possible. | |
| bool | canCreateIteratorAtKey () const |
Returns true if an iterator pointing to an entry in the container can be created using \l createIteratorAtKey(), otherwise returns false. | |
| void * | createIteratorAtKey (void *container, const void *key) const |
| Returns a non-const iterator pointing to the entry of key in the container, if possible. | |
| bool | canCreateConstIteratorAtKey () const |
Returns true if a const iterator pointing to an entry in the container can be created using \l createConstIteratorAtKey(), otherwise returns false. | |
| void * | createConstIteratorAtKey (const void *container, const void *key) const |
| Returns a const iterator pointing to the entry of key in the container, if possible. | |
| const QtMetaContainerPrivate::QMetaAssociationInterface * | iface () const |
| Public Member Functions inherited from QMetaContainer | |
| QMetaContainer ()=default | |
| QMetaContainer (const QtMetaContainerPrivate::QMetaContainerInterface *d) | |
| bool | hasInputIterator () const |
Returns true if the underlying container provides at least an input iterator as defined by std::input_iterator_tag, otherwise returns false. | |
| bool | hasForwardIterator () const |
Returns true if the underlying container provides at least a forward iterator as defined by std::forward_iterator_tag, otherwise returns false. | |
| bool | hasBidirectionalIterator () const |
Returns true if the underlying container provides a bi-directional iterator or a random access iterator as defined by std::bidirectional_iterator_tag and std::random_access_iterator_tag, respectively. | |
| bool | hasRandomAccessIterator () const |
Returns true if the underlying container provides a random access iterator as defined by std::random_access_iterator_tag, otherwise returns false. | |
| bool | hasSize () const |
Returns true if the container can be queried for its size, false otherwise. | |
| qsizetype | size (const void *container) const |
| Returns the number of values in the given container if it can be queried for its size. | |
| bool | canClear () const |
Returns true if the container can be cleared, false otherwise. | |
| void | clear (void *container) const |
| Clears the given container if it can be cleared. | |
| bool | hasIterator () const |
Returns true if the underlying container offers a non-const iterator, false otherwise. | |
| void * | begin (void *container) const |
| Creates and returns a non-const iterator pointing to the beginning of container. | |
| void * | end (void *container) const |
| Creates and returns a non-const iterator pointing to the end of container. | |
| void | destroyIterator (const void *iterator) const |
| Destroys a non-const iterator previously created using \l begin() or \l end(). | |
| bool | compareIterator (const void *i, const void *j) const |
Returns true if the non-const iterators i and j point to the same value in the container they are iterating over, otherwise returns false. | |
| void | copyIterator (void *target, const void *source) const |
| Copies the non-const iterator source into the non-const iterator target. | |
| void | advanceIterator (void *iterator, qsizetype step) const |
| Advances the non-const iterator by step steps. | |
| qsizetype | diffIterator (const void *i, const void *j) const |
Returns the distance between the non-const iterators i and j, the equivalent of i - j. | |
| bool | hasConstIterator () const |
Returns true if the underlying container offers a const iterator, false otherwise. | |
| void * | constBegin (const void *container) const |
| Creates and returns a const iterator pointing to the beginning of container. | |
| void * | constEnd (const void *container) const |
| Creates and returns a const iterator pointing to the end of container. | |
| void | destroyConstIterator (const void *iterator) const |
| Destroys a const iterator previously created using \l constBegin() or \l constEnd(). | |
| bool | compareConstIterator (const void *i, const void *j) const |
Returns true if the const iterators i and j point to the same value in the container they are iterating over, otherwise returns false. | |
| void | copyConstIterator (void *target, const void *source) const |
| Copies the const iterator source into the const iterator target. | |
| void | advanceConstIterator (void *iterator, qsizetype step) const |
| Advances the const iterator by step steps. | |
| qsizetype | diffConstIterator (const void *i, const void *j) const |
Returns the distance between the const iterators i and j, the equivalent of i - j. | |
Static Public Member Functions | |
| template<typename T> | |
| static constexpr QMetaAssociation | fromContainer () |
Friends | |
| bool | comparesEqual (const QMetaAssociation &lhs, const QMetaAssociation &rhs) noexcept |
Additional Inherited Members | |
| Protected Attributes inherited from QMetaContainer | |
| const QtMetaContainerPrivate::QMetaContainerInterface * | d_ptr = nullptr |
\inmodule QtCore
The QMetaAssociation class allows type erased access to associative containers.
\compares equality
The class provides a number of primitive container operations, using void* as operands. This way, you can manipulate a generic container retrieved from a Variant without knowing its type.
QMetaAssociation covers both, containers with mapped values such as QMap or QHash, and containers that only hold keys such as QSet.
The void* arguments to the various methods are typically created by using a \l QVariant of the respective container or value type, and calling its \l QVariant::data() or \l QVariant::constData() methods. However, you can also pass plain pointers to objects of the container or value type.
Iterator invalidation follows the rules given by the underlying containers and is not expressed in the API. Therefore, for a truly generic container, any iterators should be considered invalid after any write operation.
Definition at line 1002 of file qmetacontainer.h.
|
default |
|
inlineexplicit |
Definition at line 1006 of file qmetacontainer.h.
|
inline |
Returns true if the container can be queried for keys using \l containsKey(), otherwise returns false.
Definition at line 1041 of file qmetacontainer.h.
|
inline |
Returns true if a const iterator pointing to an entry in the container can be created using \l createConstIteratorAtKey(), otherwise returns false.
Definition at line 1158 of file qmetacontainer.h.
|
inline |
Returns true if an iterator pointing to an entry in the container can be created using \l createIteratorAtKey(), otherwise returns false.
Definition at line 1144 of file qmetacontainer.h.
|
inline |
Returns true if a key can be retrieved from a const iterator using \l keyAtConstIterator(), otherwise returns false.
Definition at line 1092 of file qmetacontainer.h.
|
inline |
Returns true if a key can be retrieved from a non-const iterator using \l keyAtIterator(), otherwise returns false.
Definition at line 1079 of file qmetacontainer.h.
|
inline |
Returns true if a mapped value can be retrieved from a const iterator using \l mappedAtConstIterator(), otherwise returns false.
Definition at line 1118 of file qmetacontainer.h.
|
inline |
Returns true if a mapped value can be retrieved from a non-const iterator using \l mappedAtIterator(), otherwise returns false.
Definition at line 1105 of file qmetacontainer.h.
|
inline |
Returns true if the container can be queried for values using \l mappedAtKey(), otherwise returns false.
Definition at line 1055 of file qmetacontainer.h.
|
inline |
Returns true if keys can be added to the container using \l insertKey(), otherwise returns false.
Definition at line 1017 of file qmetacontainer.h.
|
inline |
Returns true if keys can be removed from the container using \l removeKey(), otherwise returns false.
Definition at line 1029 of file qmetacontainer.h.
|
inline |
Returns true if a mapped value can be set via a non-const iterator using \l setMappedAtIterator(), otherwise returns false.
Definition at line 1131 of file qmetacontainer.h.
|
inline |
Returns true if mapped values can be modified in the container using \l setMappedAtKey(), otherwise returns false.
Definition at line 1067 of file qmetacontainer.h.
Returns true if the container can be queried for keys and contains the key, otherwise returns false.
Definition at line 1047 of file qmetacontainer.h.
|
inline |
Returns a const iterator pointing to the entry of key in the container, if possible.
If the entry doesn't exist, creates a const iterator pointing to the end of the container. If no const iterator can be created, returns nullptr.
The const iterator has to be destroyed using destroyConstIterator().
Definition at line 1165 of file qmetacontainer.h.
Returns a non-const iterator pointing to the entry of key in the container, if possible.
If the entry doesn't exist, creates a non-const iterator pointing to the end of the container. If no non-const iterator can be created, returns nullptr.
The non-const iterator has to be destroyed using destroyIterator().
Definition at line 1151 of file qmetacontainer.h.
|
inlinestaticconstexpr |
Returns the QMetaAssociation corresponding to the type given as template parameter.
Definition at line 1009 of file qmetacontainer.h.
|
inline |
Definition at line 1172 of file qmetacontainer.h.
Inserts the key into the container if possible.
If the container has mapped values a default-create mapped value is associated with the key.
Definition at line 1023 of file qmetacontainer.h.
Retrieves the key pointed to by the const iterator and stores it in the memory location pointed to by key, if possible.
Definition at line 1099 of file qmetacontainer.h.
Retrieves the key pointed to by the non-const iterator and stores it in the memory location pointed to by key, if possible.
Definition at line 1086 of file qmetacontainer.h.
| QMetaType QMetaAssociation::keyMetaType | ( | ) | const |
Returns the meta type for keys in the container.
Definition at line 48 of file qmetaassociation.cpp.
Retrieves the mapped value pointed to by the const iterator and stores it in the memory location pointed to by mapped, if possible.
Definition at line 1125 of file qmetacontainer.h.
Retrieves the mapped value pointed to by the non-const iterator and stores it in the memory location pointed to by mapped, if possible.
Definition at line 1112 of file qmetacontainer.h.
|
inline |
Retrieves the mapped value associated with the key in the container and places it in the memory location pointed to by mapped, if that is possible.
Definition at line 1061 of file qmetacontainer.h.
| QMetaType QMetaAssociation::mappedMetaType | ( | ) | const |
Returns the meta type for mapped values in the container.
Definition at line 58 of file qmetaassociation.cpp.
Removes the key and its associated mapped value from the container if possible.
Definition at line 1035 of file qmetacontainer.h.
|
inline |
Writes the mapped value to the container location pointed to by the non-const iterator, if possible.
Definition at line 1138 of file qmetacontainer.h.
|
inline |
Overwrites the value associated with the key in the container using the mapped value passed as argument if that is possible.
Definition at line 1073 of file qmetacontainer.h.
|
friend |
Definition at line 1175 of file qmetacontainer.h.