![]() |
Qt 6.x
The Qt SDK
|
#include <qmetacontainer.h>
Public Member Functions | |
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. | |
Protected Attributes | |
const QtMetaContainerPrivate::QMetaContainerInterface * | d_ptr = nullptr |
Definition at line 885 of file qmetacontainer.h.
|
default |
|
inlineexplicit |
Definition at line 889 of file qmetacontainer.h.
Advances the const iterator by step steps.
If steps is negative the iterator is moved backwards, towards the beginning of the container. The behavior is unspecified for negative values of step if \l hasBidirectionalIterator() returns false.
Definition at line 748 of file qmetacontainer.cpp.
References QtMetaContainerPrivate::QMetaContainerInterface::advanceConstIteratorFn, d_ptr, and hasConstIterator().
Referenced by QSequentialIterable::at(), and iterateQObjectContainer().
Advances the non-const iterator by step steps.
If steps is negative the iterator is moved backwards, towards the beginning of the container. The behavior is unspecified for negative values of step if \l hasBidirectionalIterator() returns false.
Definition at line 500 of file qmetacontainer.cpp.
References QtMetaContainerPrivate::QMetaContainerInterface::advanceIteratorFn, d_ptr, and hasIterator().
Referenced by QSequentialIterable::set().
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 \l destroyIterator eventually, to reclaim the memory.
Returns nullptr
if the container doesn't offer any non-const iterators.
Definition at line 431 of file qmetacontainer.cpp.
References QtMetaContainerPrivate::QMetaContainerInterface::AtBegin, QtMetaContainerPrivate::QMetaContainerInterface::createIteratorFn, d_ptr, and hasIterator().
Referenced by QSequentialIterable::set().
bool QMetaContainer::canClear | ( | ) | const |
Returns true
if the container can be cleared, false
otherwise.
Definition at line 271 of file qmetacontainer.cpp.
References QtMetaContainerPrivate::QMetaContainerInterface::clearFn, and d_ptr.
Referenced by clear().
Clears the given container if it can be cleared.
Definition at line 281 of file qmetacontainer.cpp.
References canClear(), QtMetaContainerPrivate::QMetaContainerInterface::clearFn, and d_ptr.
Returns true
if the const iterators i and j point to the same value in the container they are iterating over, otherwise returns false
.
Definition at line 723 of file qmetacontainer.cpp.
References QtMetaContainerPrivate::QMetaContainerInterface::compareConstIteratorFn, d_ptr, hasConstIterator(), i, and j.
Referenced by iterateQObjectContainer().
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
.
Definition at line 475 of file qmetacontainer.cpp.
References QtMetaContainerPrivate::QMetaContainerInterface::compareIteratorFn, d_ptr, hasIterator(), i, and j.
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 \l destroyConstIterator eventually, to reclaim the memory.
Returns nullptr
if the container doesn't offer any const iterators.
Definition at line 679 of file qmetacontainer.cpp.
References QtMetaContainerPrivate::QMetaContainerInterface::AtBegin, QtMetaContainerPrivate::QMetaContainerInterface::createConstIteratorFn, d_ptr, and hasConstIterator().
Referenced by QSequentialIterable::at(), and iterateQObjectContainer().
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 \l destroyConstIterator eventually, to reclaim the memory.
Returns nullptr
if the container doesn't offer any const iterators.
Definition at line 696 of file qmetacontainer.cpp.
References QtMetaContainerPrivate::QMetaContainerInterface::AtEnd, QtMetaContainerPrivate::QMetaContainerInterface::createConstIteratorFn, d_ptr, and hasConstIterator().
Referenced by iterateQObjectContainer().
Copies the const iterator source into the const iterator target.
Afterwards compareConstIterator(target, source) returns true
.
Definition at line 734 of file qmetacontainer.cpp.
References QtMetaContainerPrivate::QMetaContainerInterface::copyConstIteratorFn, d_ptr, and hasConstIterator().
Copies the non-const iterator source into the non-const iterator target.
Afterwards compareIterator(target, source) returns true
.
Definition at line 486 of file qmetacontainer.cpp.
References QtMetaContainerPrivate::QMetaContainerInterface::copyIteratorFn, d_ptr, and hasIterator().
Destroys a const iterator previously created using \l constBegin() or \l constEnd().
Definition at line 710 of file qmetacontainer.cpp.
References d_ptr, QtMetaContainerPrivate::QMetaContainerInterface::destroyConstIteratorFn, and hasConstIterator().
Referenced by QSequentialIterable::at(), and iterateQObjectContainer().
Destroys a non-const iterator previously created using \l begin() or \l end().
Definition at line 462 of file qmetacontainer.cpp.
References d_ptr, QtMetaContainerPrivate::QMetaContainerInterface::destroyIteratorFn, and hasIterator().
Referenced by QSequentialIterable::set().
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 \l hasBidirectionalIterator() returns false.
Definition at line 762 of file qmetacontainer.cpp.
References d_ptr, QtMetaContainerPrivate::QMetaContainerInterface::diffConstIteratorFn, hasConstIterator(), i, and j.
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 \l hasBidirectionalIterator() returns false.
Definition at line 514 of file qmetacontainer.cpp.
References d_ptr, QtMetaContainerPrivate::QMetaContainerInterface::diffIteratorFn, hasIterator(), i, and j.
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 \l destroyIterator eventually, to reclaim the memory.
Returns nullptr
if the container doesn't offer any non-const iterators.
Definition at line 448 of file qmetacontainer.cpp.
References QtMetaContainerPrivate::QMetaContainerInterface::AtEnd, QtMetaContainerPrivate::QMetaContainerInterface::createIteratorFn, d_ptr, and hasIterator().
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.
Definition at line 81 of file qmetacontainer.cpp.
References QtMetaContainerPrivate::BiDirectionalCapability, d_ptr, and QtMetaContainerPrivate::QMetaContainerInterface::iteratorCapabilities.
Referenced by QTaggedIterator< Iterator, IteratorCategory >::QTaggedIterator().
bool QMetaContainer::hasConstIterator | ( | ) | const |
Returns true
if the underlying container offers a const iterator, false
otherwise.
Definition at line 658 of file qmetacontainer.cpp.
References QtMetaContainerPrivate::QMetaContainerInterface::advanceConstIteratorFn, QtMetaContainerPrivate::QMetaContainerInterface::compareConstIteratorFn, QtMetaContainerPrivate::QMetaContainerInterface::copyConstIteratorFn, QtMetaContainerPrivate::QMetaContainerInterface::createConstIteratorFn, d_ptr, QtMetaContainerPrivate::QMetaContainerInterface::destroyConstIteratorFn, QtMetaContainerPrivate::QMetaContainerInterface::diffConstIteratorFn, and Q_ASSERT.
Referenced by advanceConstIterator(), compareConstIterator(), constBegin(), constEnd(), copyConstIterator(), destroyConstIterator(), diffConstIterator(), QV4::ExecutionEngine::fromData(), iterateQObjectContainer(), and QQmlListAccessor::setList().
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.
Definition at line 65 of file qmetacontainer.cpp.
References d_ptr, QtMetaContainerPrivate::ForwardCapability, and QtMetaContainerPrivate::QMetaContainerInterface::iteratorCapabilities.
Referenced by QTaggedIterator< Iterator, IteratorCategory >::QTaggedIterator().
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.
Definition at line 48 of file qmetacontainer.cpp.
References d_ptr, QtMetaContainerPrivate::InputCapability, and QtMetaContainerPrivate::QMetaContainerInterface::iteratorCapabilities.
Referenced by QTaggedIterator< Iterator, IteratorCategory >::QTaggedIterator().
bool QMetaContainer::hasIterator | ( | ) | const |
Returns true
if the underlying container offers a non-const iterator, false
otherwise.
Definition at line 410 of file qmetacontainer.cpp.
References QtMetaContainerPrivate::QMetaContainerInterface::advanceIteratorFn, QtMetaContainerPrivate::QMetaContainerInterface::compareIteratorFn, QtMetaContainerPrivate::QMetaContainerInterface::copyIteratorFn, QtMetaContainerPrivate::QMetaContainerInterface::createIteratorFn, d_ptr, QtMetaContainerPrivate::QMetaContainerInterface::destroyIteratorFn, QtMetaContainerPrivate::QMetaContainerInterface::diffIteratorFn, and Q_ASSERT.
Referenced by advanceIterator(), begin(), compareIterator(), copyIterator(), destroyIterator(), diffIterator(), and end().
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.
Definition at line 96 of file qmetacontainer.cpp.
References d_ptr, QtMetaContainerPrivate::QMetaContainerInterface::iteratorCapabilities, and QtMetaContainerPrivate::RandomAccessCapability.
Referenced by QTaggedIterator< Iterator, IteratorCategory >::QTaggedIterator().
bool QMetaContainer::hasSize | ( | ) | const |
Returns true
if the container can be queried for its size, false
otherwise.
Definition at line 250 of file qmetacontainer.cpp.
References d_ptr, and QtMetaContainerPrivate::QMetaContainerInterface::sizeFn.
Referenced by QV4::ExecutionEngine::fromData(), QQmlListAccessor::setList(), and size().
Returns the number of values in the given container if it can be queried for its size.
Otherwise returns -1
.
Definition at line 261 of file qmetacontainer.cpp.
References d_ptr, hasSize(), and QtMetaContainerPrivate::QMetaContainerInterface::sizeFn.
Referenced by QQmlListAccessor::count(), and QV4::Sequence::virtualMetacall().
|
protected |
Definition at line 921 of file qmetacontainer.h.
Referenced by advanceConstIterator(), advanceIterator(), begin(), canClear(), clear(), compareConstIterator(), compareIterator(), constBegin(), constEnd(), copyConstIterator(), copyIterator(), destroyConstIterator(), destroyIterator(), diffConstIterator(), diffIterator(), end(), hasBidirectionalIterator(), hasConstIterator(), hasForwardIterator(), hasInputIterator(), hasIterator(), hasRandomAccessIterator(), hasSize(), and size().