The QMetaContainer class provides common functionality for sequential and associative containers. 更多...
| 头: |
#include <QMetaContainer>
|
| CMake: |
find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
|
| qmake: |
QT += core
|
| Since: | Qt 6.0 |
| 继承者: |
此类 相等可比较 .
| 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 |
QMetaContainer is part of Qt's meta-type system that allows type-erased access to container-like types at runtime.
It serves as a common base for accessing properties of containers in a generic way, such as size, iteration, and clearing operations, without knowing the actual container type.
Derived classes, such as QMetaSequence , provide specialized interfaces for sequential containers.
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 () 返回 false。
另请参阅 constBegin () 和 constEnd ().
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 () 返回 false。
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.
返回
nullptr
if the container doesn't offer any non-const iterators.
另请参阅 end (), constBegin (), constEnd (),和 destroyIterator ().
返回
true
if the container can be cleared,
false
否则。
另请参阅 clear ().
Clears the given container if it can be cleared.
另请参阅 canClear ().
返回
true
if the const iterators
i
and
j
point to the same value in the container they are iterating over, otherwise returns
false
.
另请参阅 constBegin () 和 constEnd ().
返回
true
if the non-const iterators
i
and
j
point to the same value in the container they are iterating over, otherwise returns
false
.
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.
返回
nullptr
if the container doesn't offer any const iterators.
另请参阅 constEnd (), begin (), end (),和 destroyConstIterator ().
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.
返回
nullptr
if the container doesn't offer any const iterators.
另请参阅 constBegin (), begin (), end (),和 destroyConstIterator ().
Copies the const iterator
source
into the const iterator
target
. Afterwards
compareConstIterator
(target, source) returns
true
.
另请参阅 constBegin () 和 constEnd ().
Copies the non-const iterator
source
into the non-const iterator
target
. Afterwards
compareIterator
(target, source) returns
true
.
Destroys a const iterator previously created using constBegin () 或 constEnd ().
另请参阅 constBegin (), constEnd (),和 destroyIterator ().
Destroys a non-const iterator previously created using begin () 或 end ().
另请参阅 begin (), end (),和 destroyConstIterator ().
Returns the distance between the const iterators
i
and
j
, the equivalent of
i
-
j
。若
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
() 返回 false。
另请参阅 constBegin () 和 constEnd ().
Returns the distance between the non-const iterators
i
and
j
, the equivalent of
i
-
j
。若
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
() 返回 false。
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.
返回
nullptr
if the container doesn't offer any non-const iterators.
另请参阅 hasIterator (), begin (), constBegin (), constEnd (),和 destroyIterator ().
返回
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
.
QMetaContainer assumes that const and non-const iterators for the same container have the same iterator traits.
返回
true
if the underlying container offers a const iterator,
false
否则。
另请参阅 constBegin (), constEnd (), destroyConstIterator (), compareConstIterator (), diffConstIterator (), advanceConstIterator (),和 copyConstIterator ().
返回
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.
QMetaContainer assumes that const and non-const iterators for the same container have the same iterator traits.
返回
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.
QMetaContainer assumes that const and non-const iterators for the same container have the same iterator traits.
返回
true
if the underlying container offers a non-const iterator,
false
否则。
另请参阅 begin (), end (), destroyIterator (), compareIterator (), diffIterator (), advanceIterator (),和 copyIterator ().
返回
true
if the underlying container provides a random access iterator as defined by std::random_access_iterator_tag, otherwise returns
false
.
QMetaContainer assumes that const and non-const iterators for the same container have the same iterator traits.
返回
true
if the container can be queried for its size,
false
否则。
另请参阅 size ().
Returns the number of values in the given
container
if it can be queried for its size. Otherwise returns
-1
.
另请参阅 hasSize ().