QMetaContainer Class

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
继承者:

QMetaSequence

此类 equality-comparable .

公共函数

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

详细描述

成员函数文档编制

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 () 返回 false。

另请参阅 constBegin () 和 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 () 返回 false。

另请参阅 begin () 和 end ().

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.

返回 nullptr if the container doesn't offer any non-const iterators.

另请参阅 end (), constBegin (), constEnd (),和 destroyIterator ().

bool QMetaContainer:: canClear () const

返回 true if the container can be cleared, false 否则。

另请参阅 clear ().

void QMetaContainer:: clear ( void * container ) const

Clears the given container if it can be cleared.

另请参阅 canClear ().

bool QMetaContainer:: compareConstIterator (const void * i , const void * j ) const

返回 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 ().

bool QMetaContainer:: compareIterator (const void * i , const void * j ) const

返回 true if the non-const iterators i and j point to the same value in the container they are iterating over, otherwise returns false .

另请参阅 begin () 和 end ().

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.

返回 nullptr if the container doesn't offer any const iterators.

另请参阅 constEnd (), begin (), end (),和 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.

返回 nullptr if the container doesn't offer any const iterators.

另请参阅 constBegin (), begin (), end (),和 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 .

另请参阅 constBegin () 和 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 .

另请参阅 begin () 和 end ().

void QMetaContainer:: destroyConstIterator (const void * iterator ) const

Destroys a const iterator previously created using constBegin () 或 constEnd ().

另请参阅 constBegin (), constEnd (),和 destroyIterator ().

void QMetaContainer:: destroyIterator (const void * iterator ) const

Destroys a non-const iterator previously created using begin () 或 end ().

另请参阅 begin (), end (),和 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 。若 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 ().

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 。若 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。

另请参阅 begin () 和 end ().

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.

返回 nullptr if the container doesn't offer any non-const iterators.

另请参阅 hasIterator (), end(), constBegin (), constEnd (),和 destroyIterator ().

bool QMetaContainer:: hasBidirectionalIterator () const

返回 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

返回 true if the underlying container offers a const iterator, false 否则。

另请参阅 constBegin (), constEnd (), destroyConstIterator (), compareConstIterator (), diffConstIterator (), advanceConstIterator (),和 copyConstIterator ().

bool QMetaContainer:: hasForwardIterator () const

返回 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

返回 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

返回 true if the underlying container offers a non-const iterator, false 否则。

另请参阅 begin (), end (), destroyIterator (), compareIterator (), diffIterator (), advanceIterator (),和 copyIterator ().

bool QMetaContainer:: hasRandomAccessIterator () const

返回 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

返回 true if the container can be queried for its size, false 否则。

另请参阅 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 .

另请参阅 hasSize ().