![]() |
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 Types | |
| using | Iterable = QtMetaContainerPrivate::Association |
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 1059 of file qmetacontainer.h.
Definition at line 1116 of file qmetacontainer.h.
|
default |
|
inlineexplicit |
Definition at line 1120 of file qmetacontainer.h.
|
inline |
Returns true if the container can be queried for keys using \l containsKey(), otherwise returns false.
Definition at line 1155 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 1272 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 1258 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 1206 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 1193 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 1232 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 1219 of file qmetacontainer.h.
|
inline |
Returns true if the container can be queried for values using \l mappedAtKey(), otherwise returns false.
Definition at line 1169 of file qmetacontainer.h.
|
inline |
Returns true if keys can be added to the container using \l insertKey(), otherwise returns false.
Definition at line 1131 of file qmetacontainer.h.
|
inline |
Returns true if keys can be removed from the container using \l removeKey(), otherwise returns false.
Definition at line 1143 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 1245 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 1181 of file qmetacontainer.h.
Returns true if the container can be queried for keys and contains the key, otherwise returns false.
Definition at line 1161 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 1279 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 1265 of file qmetacontainer.h.
|
inlinestaticconstexpr |
Returns the QMetaAssociation corresponding to the type given as template parameter.
Definition at line 1123 of file qmetacontainer.h.
|
inline |
Definition at line 1286 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 1137 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 1213 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 1200 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 1239 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 1226 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 1175 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 1149 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 1252 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 1187 of file qmetacontainer.h.
|
friend |
Definition at line 1289 of file qmetacontainer.h.