QMetaSequence Class▲
-
Header: QMetaSequence
-
Since: Qt 6.0
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
-
qmake: QT += core
-
Inherits: QMetaContainer
-
Group: QMetaSequence is part of objectmodel
Detailed Description▲
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 QVariant of the respective container or value type, and calling its QVariant::data() or 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.
Member Function Documentation▲
void QMetaSequence::addValue(void *container, const void *value) const▲
Adds value to the container if possible. If canAddValue() returns false, the value is not added. Else, if canAddValueAtEnd() returns true, the value is added to the end of the container. Else, if 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 QSet.
See Also▲
See also canAddValue(), canAddValueAtBegin(), canAddValueAtEnd(), isSortable(), removeValue()
void QMetaSequence::addValueAtBegin(void *container, const void *value) const▲
Adds value to the beginning of container if possible. If canAddValueAtBegin() returns false, the value is not added.
See Also▲
See also canAddValueAtBegin(), isSortable(), removeValueAtBegin()
void QMetaSequence::addValueAtEnd(void *container, const void *value) const▲
Adds value to the end of container if possible. If canAddValueAtEnd() returns false, the value is not added.
See Also▲
See also canAddValueAtEnd(), isSortable(), removeValueAtEnd()
bool QMetaSequence::canAddValue() const▲
Returns true if values can be added to the container, false otherwise.
See Also▲
See also addValue(), isSortable()
bool QMetaSequence::canAddValueAtBegin() const▲
Returns true if values added using addValue() can be placed at the beginning of the container, otherwise returns false.
See Also▲
See also addValueAtBegin(), canAddValueAtEnd()
bool QMetaSequence::canAddValueAtEnd() const▲
Returns true if values added using addValue() can be placed at the end of the container, otherwise returns false.
See Also▲
See also addValueAtEnd(), canAddValueAtBegin()
bool QMetaSequence::canEraseRangeAtIterator() const▲
Returns true if a range between two iterators can be erased from the container, false otherwise.
bool QMetaSequence::canEraseValueAtIterator() const▲
Returns true if the value pointed to by a non-const iterator can be erased, false otherwise.
See Also▲
See also hasIterator(), eraseValueAtIterator()
bool QMetaSequence::canGetValueAtConstIterator() const▲
Returns true if the underlying container can retrieve the value pointed to by a const iterator, false otherwise.
See Also▲
See also hasConstIterator(), valueAtConstIterator()
bool QMetaSequence::canGetValueAtIndex() const▲
Returns true if values can be retrieved from the container by index, otherwise false.
See Also▲
See also valueAtIndex()
bool QMetaSequence::canGetValueAtIterator() const▲
Returns true if the underlying container can retrieve the value pointed to by a non-const iterator, false otherwise.
See Also▲
See also hasIterator(), valueAtIterator()
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.
See Also▲
See also hasIterator(), insertValueAtIterator()
bool QMetaSequence::canRemoveValue() const▲
Returns true if values can be removed from the container, false otherwise.
See Also▲
See also removeValue(), isSortable()
bool QMetaSequence::canRemoveValueAtBegin() const▲
Returns true if values can be removed from the beginning of the container using removeValue() can be placed at the, otherwise returns false.
See Also▲
See also removeValueAtBegin(), canRemoveValueAtEnd()
bool QMetaSequence::canRemoveValueAtEnd() const▲
Returns true if values can be removed from the end of the container using removeValue() can be placed at the, otherwise returns false.
See Also▲
See also removeValueAtEnd(), canRemoveValueAtBegin()
bool QMetaSequence::canSetValueAtIndex() const▲
Returns true if an value can be written to the container by index, otherwise false.
See Also▲
See also setValueAtIndex()
bool QMetaSequence::canSetValueAtIterator() const▲
Returns true if the underlying container can write to the value pointed to by a non-const iterator, false otherwise.
See Also▲
See also hasIterator(), setValueAtIterator()
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.
See Also▲
See also canEraseValueAtIterator(), begin(), end()
void QMetaSequence::eraseValueAtIterator(void *container, const void *iterator) const▲
Erases the value pointed to by the non-const iterator from the container, if possible.
See Also▲
See also canEraseValueAtIterator(), begin(), end()
[static constexpr, since 6.0] QMetaSequence QMetaSequence::fromContainer()▲
Returns the QMetaSequence corresponding to the type given as template parameter.
This function was introduced in Qt 6.0.
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 canInsertValueAtIterator() returns false, the value is not inserted. Else if 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 addValue() without iterator.
See Also▲
See also canInsertValueAtIterator(), isSortable(), begin(), end()
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.
See Also▲
See also addValue(), insertValueAtIterator(), canAddValueAtBegin(), canAddValueAtEnd(), canRemoveValueAtBegin(), canRemoveValueAtEnd()
void QMetaSequence::removeValue(void *container) const▲
Removes an value from the container if possible. If canRemoveValue() returns false, no value is removed. Else, if canRemoveValueAtEnd() returns true, the last value in the container is removed. Else, if canRemoveValueAtBegin() returns true, the first value in the container is removed. Else, an unspecified value or nothing is removed.
See Also▲
See also canRemoveValue(), canRemoveValueAtBegin(), canRemoveValueAtEnd(), isSortable(), addValue()
void QMetaSequence::removeValueAtBegin(void *container) const▲
Removes a value from the beginning of container if possible. If canRemoveValueAtBegin() returns false, the value is not removed.
See Also▲
See also canRemoveValueAtBegin(), isSortable(), addValueAtBegin()
void QMetaSequence::removeValueAtEnd(void *container) const▲
Removes a value from the end of container if possible. If canRemoveValueAtEnd() returns false, the value is not removed.
See Also▲
See also canRemoveValueAtEnd(), isSortable(), addValueAtEnd()
void QMetaSequence::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.
See Also▲
See also valueAtIndex(), canSetValueAtIndex()
void QMetaSequence::setValueAtIterator(const void *iterator, const void *value) const▲
Writes value to the value pointed to by the non-const iterator, if possible.
See Also▲
See also valueAtIterator(), canSetValueAtIterator(), begin(), end()
void QMetaSequence::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.
See Also▲
See also canGetValueAtConstIterator(), constBegin(), constEnd()
void QMetaSequence::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.
See Also▲
See also setValueAtIndex(), canGetValueAtIndex()
void QMetaSequence::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.
See Also▲
See also setValueAtIterator(), canGetValueAtIterator(), begin(), end()
QMetaType QMetaSequence::valueMetaType() const▲
Returns the meta type for values stored in the container.