![]() |
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 | |
QMetaSequence ()=default | |
QMetaSequence (const QtMetaContainerPrivate::QMetaSequenceInterface *d) | |
QMetaType | valueMetaType () const |
Returns the meta type for values stored in the container. | |
bool | isSortable () const |
Returns true if the underlying container is sortable, otherwise returns false . | |
bool | canAddValueAtBegin () const |
Returns true if values added using \l addValue() can be placed at the beginning of the container, otherwise returns false . | |
void | addValueAtBegin (void *container, const void *value) const |
Adds value to the beginning of container if possible. | |
bool | canAddValueAtEnd () const |
Returns true if values added using \l addValue() can be placed at the end of the container, otherwise returns false . | |
void | addValueAtEnd (void *container, const void *value) const |
Adds value to the end of container if possible. | |
bool | canRemoveValueAtBegin () const |
Returns true if values can be removed from the beginning of the container using \l removeValue() can be placed at the, otherwise returns false . | |
void | removeValueAtBegin (void *container) const |
Removes a value from the beginning of container if possible. | |
bool | canRemoveValueAtEnd () const |
Returns true if values can be removed from the end of the container using \l removeValue() can be placed at the, otherwise returns false . | |
void | removeValueAtEnd (void *container) const |
Removes a value from the end of container if possible. | |
bool | canGetValueAtIndex () const |
Returns true if values can be retrieved from the container by index, otherwise false . | |
void | valueAtIndex (const void *container, qsizetype index, void *result) const |
Retrieves the value at index in the container and places it in the memory location pointed to by result, if that is possible. | |
bool | canSetValueAtIndex () const |
Returns true if an value can be written to the container by index, otherwise false . | |
void | setValueAtIndex (void *container, qsizetype index, const void *value) const |
Overwrites the value at index in the container using the value passed as parameter if that is possible. | |
bool | canAddValue () const |
Returns true if values can be added to the container, false otherwise. | |
void | addValue (void *container, const void *value) const |
Adds value to the container if possible. | |
bool | canRemoveValue () const |
Returns true if values can be removed from the container, false otherwise. | |
void | removeValue (void *container) const |
Removes an value from the container if possible. | |
bool | canGetValueAtIterator () const |
Returns true if the underlying container can retrieve the value pointed to by a non-const iterator, false otherwise. | |
void | valueAtIterator (const void *iterator, void *result) const |
Retrieves the value pointed to by the non-const iterator and stores it in the memory location pointed to by result, if possible. | |
bool | canSetValueAtIterator () const |
Returns true if the underlying container can write to the value pointed to by a non-const iterator, false otherwise. | |
void | setValueAtIterator (const void *iterator, const void *value) const |
Writes value to the value pointed to by the non-const iterator, if possible. | |
bool | canInsertValueAtIterator () const |
Returns true if the underlying container can insert a new value, taking the location pointed to by a non-const iterator into account. | |
void | insertValueAtIterator (void *container, const void *iterator, const void *value) const |
Inserts value into the container, if possible, taking the non-const iterator into account. | |
bool | canEraseValueAtIterator () const |
Returns true if the value pointed to by a non-const iterator can be erased, false otherwise. | |
void | eraseValueAtIterator (void *container, const void *iterator) const |
Erases the value pointed to by the non-const iterator from the container, if possible. | |
bool | canEraseRangeAtIterator () const |
Returns true if a range between two iterators can be erased from the container, false otherwise. | |
void | eraseRangeAtIterator (void *container, const void *iterator1, const void *iterator2) const |
Erases the range of values between the iterators iterator1 and iterator2 from the container, if possible. | |
bool | canGetValueAtConstIterator () const |
Returns true if the underlying container can retrieve the value pointed to by a const iterator, false otherwise. | |
void | valueAtConstIterator (const void *iterator, void *result) const |
Retrieves the value pointed to by the const iterator and stores it in the memory location pointed to by result, if possible. | |
const QtMetaContainerPrivate::QMetaSequenceInterface * | iface () const |
![]() | |
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 QMetaSequence | fromContainer () |
Friends | |
bool | comparesEqual (const QMetaSequence &lhs, const QMetaSequence &rhs) noexcept |
Additional Inherited Members | |
![]() | |
const QtMetaContainerPrivate::QMetaContainerInterface * | d_ptr = nullptr |
\inmodule QtCore
The QMetaSequence class allows type erased access to sequential 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.
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 925 of file qmetacontainer.h.
|
default |
|
inlineexplicit |
Definition at line 929 of file qmetacontainer.h.
Adds value to the container if possible.
If \l canAddValue() returns false
, the value is not added. Else, if \l canAddValueAtEnd() returns true
, the value is added to the end of the container. Else, if \l canAddValueAtBegin() returns true
, the value is added to the beginning of the container. Else, the value is added in an unspecified place or not at all. The latter is the case for adding values to an unordered container, for example \l QSet.
Definition at line 377 of file qmetacontainer.cpp.
Adds value to the beginning of container if possible.
If \l canAddValueAtBegin() returns false
, the value is not added.
Definition at line 171 of file qmetacontainer.cpp.
Adds value to the end of container if possible.
If \l canAddValueAtEnd() returns false
, the value is not added.
Definition at line 225 of file qmetacontainer.cpp.
bool QMetaSequence::canAddValue | ( | ) | const |
Returns true
if values can be added to the container, false
otherwise.
Definition at line 357 of file qmetacontainer.cpp.
bool QMetaSequence::canAddValueAtBegin | ( | ) | const |
Returns true
if values added using \l addValue() can be placed at the beginning of the container, otherwise returns false
.
Definition at line 156 of file qmetacontainer.cpp.
bool QMetaSequence::canAddValueAtEnd | ( | ) | const |
Returns true
if values added using \l addValue() can be placed at the end of the container, otherwise returns false
.
Definition at line 210 of file qmetacontainer.cpp.
bool QMetaSequence::canEraseRangeAtIterator | ( | ) | const |
Returns true
if a range between two iterators can be erased from the container, false
otherwise.
Definition at line 644 of file qmetacontainer.cpp.
bool QMetaSequence::canEraseValueAtIterator | ( | ) | const |
Returns true
if the value pointed to by a non-const iterator can be erased, false
otherwise.
Definition at line 621 of file qmetacontainer.cpp.
bool QMetaSequence::canGetValueAtConstIterator | ( | ) | const |
Returns true
if the underlying container can retrieve the value pointed to by a const iterator, false
otherwise.
Definition at line 787 of file qmetacontainer.cpp.
bool QMetaSequence::canGetValueAtIndex | ( | ) | const |
Returns true
if values can be retrieved from the container by index, otherwise false
.
Definition at line 307 of file qmetacontainer.cpp.
bool QMetaSequence::canGetValueAtIterator | ( | ) | const |
Returns true
if the underlying container can retrieve the value pointed to by a non-const iterator, false
otherwise.
Definition at line 539 of file qmetacontainer.cpp.
bool QMetaSequence::canInsertValueAtIterator | ( | ) | const |
Returns true
if the underlying container can insert a new value, taking the location pointed to by a non-const iterator into account.
Definition at line 589 of file qmetacontainer.cpp.
bool QMetaSequence::canRemoveValue | ( | ) | const |
Returns true
if values can be removed from the container, false
otherwise.
Definition at line 391 of file qmetacontainer.cpp.
bool QMetaSequence::canRemoveValueAtBegin | ( | ) | const |
Returns true
if values can be removed from the beginning of the container using \l removeValue() can be placed at the, otherwise returns false
.
Definition at line 183 of file qmetacontainer.cpp.
bool QMetaSequence::canRemoveValueAtEnd | ( | ) | const |
Returns true
if values can be removed from the end of the container using \l removeValue() can be placed at the, otherwise returns false
.
Definition at line 237 of file qmetacontainer.cpp.
bool QMetaSequence::canSetValueAtIndex | ( | ) | const |
Returns true
if an value can be written to the container by index, otherwise false
.
Definition at line 332 of file qmetacontainer.cpp.
bool QMetaSequence::canSetValueAtIterator | ( | ) | const |
Returns true
if the underlying container can write to the value pointed to by a non-const iterator, false
otherwise.
Definition at line 564 of file qmetacontainer.cpp.
void QMetaSequence::eraseRangeAtIterator | ( | void * | container, |
const void * | iterator1, | ||
const void * | iterator2 ) const |
Erases the range of values between the iterators iterator1 and iterator2 from the container, if possible.
Definition at line 657 of file qmetacontainer.cpp.
Erases the value pointed to by the non-const iterator from the container, if possible.
Definition at line 634 of file qmetacontainer.cpp.
|
inlinestaticconstexpr |
Returns the QMetaSequence corresponding to the type given as template parameter.
Definition at line 932 of file qmetacontainer.h.
|
inline |
Definition at line 979 of file qmetacontainer.h.
void QMetaSequence::insertValueAtIterator | ( | void * | container, |
const void * | iterator, | ||
const void * | value ) const |
Inserts value into the container, if possible, taking the non-const iterator into account.
If \l canInsertValueAtIterator() returns false
, the value is not inserted. Else if \l isSortable() returns true
, the value is inserted before the value pointed to by iterator. Else, the value is inserted at an unspecified place or not at all. In the latter case, the iterator is taken as a hint. If it points to the correct place for the value, the operation may be faster than a \l addValue() without iterator.
Definition at line 608 of file qmetacontainer.cpp.
bool QMetaSequence::isSortable | ( | ) | const |
Returns true
if the underlying container is sortable, otherwise returns false
.
A container is considered sortable if values added to it are placed in a defined location. Inserting into or adding to a sortable container will always succeed. Inserting into or adding to an unsortable container may not succeed, for example if the container is a QSet that already contains the value being inserted.
Definition at line 138 of file qmetacontainer.cpp.
Removes an value from the container if possible.
If \l canRemoveValue() returns false
, no value is removed. Else, if \l canRemoveValueAtEnd() returns true
, the last value in the container is removed. Else, if \l canRemoveValueAtBegin() returns true
, the first value in the container is removed. Else, an unspecified value or nothing is removed.
Definition at line 409 of file qmetacontainer.cpp.
Removes a value from the beginning of container if possible.
If \l canRemoveValueAtBegin() returns false
, the value is not removed.
Definition at line 198 of file qmetacontainer.cpp.
Removes a value from the end of container if possible.
If \l canRemoveValueAtEnd() returns false
, the value is not removed.
Definition at line 252 of file qmetacontainer.cpp.
Overwrites the value at index in the container using the value passed as parameter if that is possible.
Definition at line 345 of file qmetacontainer.cpp.
Writes value to the value pointed to by the non-const iterator, if possible.
Definition at line 577 of file qmetacontainer.cpp.
Retrieves the value pointed to by the const iterator and stores it in the memory location pointed to by result, if possible.
Definition at line 800 of file qmetacontainer.cpp.
Retrieves the value at index in the container and places it in the memory location pointed to by result, if that is possible.
Definition at line 320 of file qmetacontainer.cpp.
Retrieves the value pointed to by the non-const iterator and stores it in the memory location pointed to by result, if possible.
Definition at line 552 of file qmetacontainer.cpp.
QMetaType QMetaSequence::valueMetaType | ( | ) | const |
Returns the meta type for values stored in the container.
Definition at line 120 of file qmetacontainer.cpp.
|
friend |
Definition at line 982 of file qmetacontainer.h.