QMetaContainer Class
The QMetaContainer class provides common functionality for sequential and associative containers. More...
Header: | #include <QMetaContainer> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
qmake: | QT += core |
Since: | Qt 6.0 |
Inherited By: |
This class is equality-comparable.
Public Functions
void | advanceConstIterator(void *iterator, qsizetype step) const |
void | advanceIterator(void *iterator, qsizetype step) const |
void * | begin(void *container) const |
bool | canClear() const |
void | clear(void *container) const |
bool | compareConstIterator(const void *i, const void *j) const |
bool | compareIterator(const void *i, const void *j) const |
void * | constBegin(const void *container) const |
void * | constEnd(const void *container) const |
void | copyConstIterator(void *target, const void *source) const |
void | copyIterator(void *target, const void *source) const |
void | destroyConstIterator(const void *iterator) const |
void | destroyIterator(const void *iterator) const |
qsizetype | diffConstIterator(const void *i, const void *j) const |
qsizetype | diffIterator(const void *i, const void *j) const |
void * | end(void *container) const |
bool | hasBidirectionalIterator() const |
bool | hasConstIterator() const |
bool | hasForwardIterator() const |
bool | hasInputIterator() const |
bool | hasIterator() const |
bool | hasRandomAccessIterator() const |
bool | hasSize() const |
qsizetype | size(const void *container) const |
Detailed Description
Member Function Documentation
void QMetaContainer::advanceConstIterator(void *iterator, qsizetype step) const
Advances the const iterator by step steps. If step is negative the iterator is moved backwards, towards the beginning of the container. The behavior is unspecified for negative values of step if hasBidirectionalIterator() returns false.
See also constBegin() and constEnd().
void QMetaContainer::advanceIterator(void *iterator, qsizetype step) const
Advances the non-const iterator by step steps. If step is negative the iterator is moved backwards, towards the beginning of the container. The behavior is unspecified for negative values of step if hasBidirectionalIterator() returns false.
void *QMetaContainer::begin(void *container) const
Creates and returns a non-const iterator pointing to the beginning of container. The iterator is allocated on the heap using new. It has to be destroyed using destroyIterator eventually, to reclaim the memory.
Returns nullptr
if the container doesn't offer any non-const iterators.
See also end(), constBegin(), constEnd(), and destroyIterator().
bool QMetaContainer::canClear() const
Returns true
if the container can be cleared, false
otherwise.
See also clear().
void QMetaContainer::clear(void *container) const
Clears the given container if it can be cleared.
See also canClear().
bool QMetaContainer::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
.
See also constBegin() and constEnd().
bool QMetaContainer::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 *QMetaContainer::constBegin(const void *container) const
Creates and returns a const iterator pointing to the beginning of container. The iterator is allocated on the heap using new. It has to be destroyed using destroyConstIterator eventually, to reclaim the memory.
Returns nullptr
if the container doesn't offer any const iterators.
See also constEnd(), begin(), end(), and destroyConstIterator().
void *QMetaContainer::constEnd(const void *container) const
Creates and returns a const iterator pointing to the end of container. The iterator is allocated on the heap using new. It has to be destroyed using destroyConstIterator eventually, to reclaim the memory.
Returns nullptr
if the container doesn't offer any const iterators.
See also constBegin(), begin(), end(), and destroyConstIterator().
void QMetaContainer::copyConstIterator(void *target, const void *source) const
Copies the const iterator source into the const iterator target. Afterwards compareConstIterator(target, source) returns true
.
See also constBegin() and constEnd().
void QMetaContainer::copyIterator(void *target, const void *source) const
Copies the non-const iterator source into the non-const iterator target. Afterwards compareIterator(target, source) returns true
.
void QMetaContainer::destroyConstIterator(const void *iterator) const
Destroys a const iterator previously created using constBegin() or constEnd().
See also constBegin(), constEnd(), and destroyIterator().
void QMetaContainer::destroyIterator(const void *iterator) const
Destroys a non-const iterator previously created using begin() or end().
See also begin(), end(), and destroyConstIterator().
qsizetype QMetaContainer::diffConstIterator(const void *i, const void *j) const
Returns the distance between the const iterators i and j, the equivalent of i -
j. If j is closer to the end of the container than i, the returned value is negative. The behavior is unspecified in this case if hasBidirectionalIterator() returns false.
See also constBegin() and constEnd().
qsizetype QMetaContainer::diffIterator(const void *i, const void *j) const
Returns the distance between the non-const iterators i and j, the equivalent of i -
j. If j is closer to the end of the container than i, the returned value is negative. The behavior is unspecified in this case if hasBidirectionalIterator() returns false.
void *QMetaContainer::end(void *container) const
Creates and returns a non-const iterator pointing to the end of container. The iterator is allocated on the heap using new. It has to be destroyed using destroyIterator eventually, to reclaim the memory.
Returns nullptr
if the container doesn't offer any non-const iterators.
See also hasIterator(), end(), constBegin(), constEnd(), and destroyIterator().
bool QMetaContainer::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. Otherwise returns false
.
QMetaSequence assumes that const and non-const iterators for the same container have the same iterator traits.
bool QMetaContainer::hasConstIterator() const
Returns true
if the underlying container offers a const iterator, false
otherwise.
See also constBegin(), constEnd(), destroyConstIterator(), compareConstIterator(), diffConstIterator(), advanceConstIterator(), and copyConstIterator().
bool QMetaContainer::hasForwardIterator() const
Returns true
if the underlying container provides at least a forward iterator as defined by std::forward_iterator_tag, otherwise returns false
. Bi-directional iterators and random access iterators are specializations of forward iterators. This method will also return true
if the container provides one of those.
QMetaSequence assumes that const and non-const iterators for the same container have the same iterator traits.
bool QMetaContainer::hasInputIterator() const
Returns true
if the underlying container provides at least an input iterator as defined by std::input_iterator_tag, otherwise returns false
. Forward, Bi-directional, and random access iterators are specializations of input iterators. This method will also return true
if the container provides one of those.
QMetaSequence assumes that const and non-const iterators for the same container have the same iterator traits.
bool QMetaContainer::hasIterator() const
Returns true
if the underlying container offers a non-const iterator, false
otherwise.
See also begin(), end(), destroyIterator(), compareIterator(), diffIterator(), advanceIterator(), and copyIterator().
bool QMetaContainer::hasRandomAccessIterator() const
Returns true
if the underlying container provides a random access iterator as defined by std::random_access_iterator_tag, otherwise returns false
.
QMetaSequence assumes that const and non-const iterators for the same container have the same iterator traits.
bool QMetaContainer::hasSize() const
Returns true
if the container can be queried for its size, false
otherwise.
See also size().
qsizetype QMetaContainer::size(const void *container) const
Returns the number of values in the given container if it can be queried for its size. Otherwise returns -1
.
See also hasSize().