QMetaSequence Class
QMetaSequenceクラスは、シーケンシャル・コンテナへの型消去アクセスを可能にします。詳細...
ヘッダー | #include <QMetaSequence> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
qmake: | QT += core |
以来: | Qt 6.0 |
継承: | QMetaContainer |
このクラスは等価比較可能です。
パブリック関数
void | addValue(void *container, const void *value) const |
void | addValueAtBegin(void *container, const void *value) const |
void | addValueAtEnd(void *container, const void *value) const |
bool | canAddValue() const |
bool | canAddValueAtBegin() const |
bool | canAddValueAtEnd() const |
bool | canEraseRangeAtIterator() const |
bool | canEraseValueAtIterator() const |
bool | canGetValueAtConstIterator() const |
bool | canGetValueAtIndex() const |
bool | canGetValueAtIterator() const |
bool | canInsertValueAtIterator() const |
bool | canRemoveValue() const |
bool | canRemoveValueAtBegin() const |
bool | canRemoveValueAtEnd() const |
bool | canSetValueAtIndex() const |
bool | canSetValueAtIterator() const |
void | eraseRangeAtIterator(void *container, const void *iterator1, const void *iterator2) const |
void | eraseValueAtIterator(void *container, const void *iterator) const |
void | insertValueAtIterator(void *container, const void *iterator, const void *value) const |
bool | isSortable() const |
void | removeValue(void *container) const |
void | removeValueAtBegin(void *container) const |
void | removeValueAtEnd(void *container) const |
void | setValueAtIndex(void *container, qsizetype index, const void *value) const |
void | setValueAtIterator(const void *iterator, const void *value) const |
void | valueAtConstIterator(const void *iterator, void *result) const |
void | valueAtIndex(const void *container, qsizetype index, void *result) const |
void | valueAtIterator(const void *iterator, void *result) const |
QMetaType | valueMetaType() const |
静的パブリックメンバ
(since 6.0) QMetaSequence | fromContainer() |
関連する非メンバー
(since 6.0) bool | operator!=(const QMetaSequence &lhs, const QMetaSequence &rhs) |
(since 6.0) bool | operator==(const QMetaSequence &lhs, const QMetaSequence &rhs) |
詳細な説明
このクラスは、オペランドとして void* を使用する、いくつかのプリミティブなコンテナ操作を提供します。こうすることで、Variantから取得した汎用コンテナを、その型を知ることなく操作することができます。
様々なメソッドへの void* 引数は、通常、それぞれのコンテナまたは値型のQVariant を使用し、そのQVariant::data() またはQVariant::constData() メソッドを呼び出すことによって作成されます。しかし、コンテナ型や値型のオブジェクトへのプレーン・ポインタを渡すこともできる。
イテレータの無効化は、基礎となるコンテナによって与えられるルールに従うものであり、APIで表現されるものではありません。そのため、真に汎用的なコンテナでは、書き込み操作の後はイテレータは無効とみなされます。
メンバ関数ドキュメント
void QMetaSequence::addValue(void *container, const void *value) const
可能であれば、container にvalue を追加する。canAddValue() がfalse
を返す場合、value は追加されない。canAddValueAtEnd() がtrue
を返す場合、value はcontainer の最後に追加される。canAddValueAtBegin() がtrue
を返す場合、value はコンテナの最初に追加される。それ以外の場合、値は指定されていない場所に追加されるか、まったく追加されない。後者は、例えばQSet のように、順序のないコンテナに値を追加する場合である。
canAddValue()、canAddValueAtBegin()、canAddValueAtEnd()、isSortable()、removeValue()も参照のこと 。
void QMetaSequence::addValueAtBegin(void *container, const void *value) const
container の先頭にvalue を追加する。canAddValueAtBegin() がfalse
を返す場合、value は追加されない。
canAddValueAtBegin()、isSortable()、removeValueAtBegin()も参照 。
void QMetaSequence::addValueAtEnd(void *container, const void *value) const
可能であれば、container の最後にvalue を追加する。canAddValueAtEnd() がfalse
を返す場合、value は追加されない。
canAddValueAtEnd()、isSortable()、removeValueAtEnd()も参照 。
bool QMetaSequence::canAddValue() const
コンテナに値を追加できる場合はtrue
を、そうでない場合はfalse
を返す。
addValue() およびisSortable()も参照 。
bool QMetaSequence::canAddValueAtBegin() const
addValue() を使って追加された値がコンテナの先頭に配置できる場合はtrue
を返し、そうでない場合はfalse
を返す。
addValueAtBegin() およびcanAddValueAtEnd()も参照 。
bool QMetaSequence::canAddValueAtEnd() const
addValue() を使って追加された値がコンテナの最後に配置できる場合はtrue
を返し、そうでない場合はfalse
を返す。
addValueAtEnd() およびcanAddValueAtBegin()も参照 。
bool QMetaSequence::canEraseRangeAtIterator() const
2つのイテレータ間の範囲をコンテナから消去できる場合はtrue
を返し、そうでない場合はfalse
を返す。
bool QMetaSequence::canEraseValueAtIterator() const
constでないイテレータが指す値が消去可能であればtrue
を返し、そうでなければfalse
を返す。
hasIterator() およびeraseValueAtIterator()も参照のこと 。
bool QMetaSequence::canGetValueAtConstIterator() const
基礎となるコンテナが const イテレータが指す値を取得できる場合はtrue
を返し、そうでない場合はfalse
を返す。
hasConstIterator() およびvalueAtConstIterator()も参照 。
bool QMetaSequence::canGetValueAtIndex() const
インデックスによってコンテナから値を取得できる場合はtrue
を返し、そうでない場合はfalse
を返す。
valueAtIndex()も参照のこと 。
bool QMetaSequence::canGetValueAtIterator() const
基礎となるコンテナが、const 以外のイテレータが指す値を取得できる場合はtrue
を返し、そうでない場合はfalse
を返す。
hasIterator() およびvalueAtIterator()も参照 。
bool QMetaSequence::canInsertValueAtIterator() const
基礎となるコンテナが、const 以外のイテレータが指す位置を考慮して新しい値を挿入できる場合、true
を返す。
hasIterator() およびinsertValueAtIterator()も参照 。
bool QMetaSequence::canRemoveValue() const
コンテナから値を削除できる場合はtrue
を返し、そうでない場合はfalse
を返す。
removeValue() およびisSortable()も参照 。
bool QMetaSequence::canRemoveValueAtBegin() const
removeValue() を使ってコンテナの先頭から値を削除できる場合はtrue
を返し、そうでない場合はfalse
を返す。
removeValueAtBegin() およびcanRemoveValueAtEnd()も参照 。
bool QMetaSequence::canRemoveValueAtEnd() const
removeValue() を使ってコンテナの末尾から値を削除できる場合はtrue
を返し、そうでない場合はfalse
を返す。
removeValueAtEnd() およびcanRemoveValueAtBegin()も参照 。
bool QMetaSequence::canSetValueAtIndex() const
インデックスによってコンテナに値を書き込める場合はtrue
を返し、そうでない場合はfalse
を返す。
setValueAtIndex()も参照のこと 。
bool QMetaSequence::canSetValueAtIterator() const
基礎となるコンテナが、const 以外のイテレータが指す値に書き込める場合はtrue
を返し、そうでない場合はfalse
を返す。
hasIterator() およびsetValueAtIterator()も参照 。
void QMetaSequence::eraseRangeAtIterator(void *container, const void *iterator1, const void *iterator2) const
イテレータiterator1 とiterator2 の間の値の範囲を、可能であればcontainer から消去する。
canEraseValueAtIterator()、begin()、end()も参照 。
void QMetaSequence::eraseValueAtIterator(void *container, const void *iterator) const
nononstiterator が指す値を、可能であればcontainer から消去する。
canEraseValueAtIterator()、begin()、end()も参照のこと 。
[static constexpr, since 6.0]
template <typename T> QMetaSequence QMetaSequence::fromContainer()
テンプレート・パラメータとして与えられた型に対応するQMetaSequence を返します。
この関数は Qt 6.0 で導入されました。
void QMetaSequence::insertValueAtIterator(void *container, const void *iterator, const void *value) const
container にvalue を挿入する。可能であれば、非構成のiterator を考慮する。canInsertValueAtIterator() がfalse
を返す場合、value は挿入されない。isSortable() がtrue
を返す場合、その値はiterator が指す値の前に挿入される。そうでない場合、value は指定されていない場所に挿入されるか、まったく挿入されない。後者の場合、iterator がヒントとなる。それがvalue の正しい場所を指している場合、イテレータのないaddValue() よりも高速に処理される可能性がある。
canInsertValueAtIterator()、isSortable()、begin()、end()も参照のこと 。
bool QMetaSequence::isSortable() const
基礎となるコンテナがソート可能であればtrue
を返し、そうでなければfalse
を返す。コンテナに追加された値が定義された場所に配置される場合、そのコンテナはソート可能であるとみなされる。ソート可能なコンテナへの挿入や追加は常に成功する。ソート不可能なコンテナへの挿入や追加は成功しないかもしれない。 例えば、コンテナがQSet 、挿入される値が既に含まれている場合などである。
addValue()、insertValueAtIterator()、canAddValueAtBegin()、canAddValueAtEnd()、canRemoveValueAtBegin()、canRemoveValueAtEnd()も参照のこと 。
void QMetaSequence::removeValue(void *container) const
可能であれば、container から値を削除する。canRemoveValue() がfalse
を返す場合、値は削除されない。canRemoveValueAtEnd() がtrue
を返す場合、container の最後の値が削除される。canRemoveValueAtBegin() がtrue
を返す場合、container の最初の値が削除される。それ以外の場合は、指定されていない値または何も削除されない。
canRemoveValue()、canRemoveValueAtBegin()、canRemoveValueAtEnd()、isSortable()、addValue()も参照のこと 。
void QMetaSequence::removeValueAtBegin(void *container) const
可能であれば、container の先頭から値を削除する。canRemoveValueAtBegin() がfalse
を返す場合、値は削除されない。
canRemoveValueAtBegin()、isSortable()、addValueAtBegin()も参照 。
void QMetaSequence::removeValueAtEnd(void *container) const
可能であれば、container の末尾から値を削除する。canRemoveValueAtEnd() がfalse
を返す場合、値は削除されない。
canRemoveValueAtEnd()、isSortable()、addValueAtEnd()も参照 。
void QMetaSequence::setValueAtIndex(void *container, qsizetype index, const void *value) const
パラメータとして渡されたvalue を使って、container のindex の値を上書きする。
valueAtIndex() およびcanSetValueAtIndex()も参照のこと 。
void QMetaSequence::setValueAtIterator(const void *iterator, const void *value) const
可能であれば、iterator が指す値に、value を書き込む。
valueAtIterator()、canSetValueAtIterator()、begin()、end()も参照のこと 。
void QMetaSequence::valueAtConstIterator(const void *iterator, void *result) const
constiterator が指す値を取得し、可能であればresult が指すメモリ位置に格納する。
canGetValueAtConstIterator()、constBegin()、constEnd()も参照 。
void QMetaSequence::valueAtIndex(const void *container, qsizetype index, void *result) const
container のindex にある値を取得し、result が指すメモリ位置に配置する。
setValueAtIndex() およびcanGetValueAtIndex()も参照のこと 。
void QMetaSequence::valueAtIterator(const void *iterator, void *result) const
nononstiterator が指す値を取得し、可能であればresult が指すメモリ位置に格納する。
setValueAtIterator()、canGetValueAtIterator()、begin()、end()も参照のこと 。
QMetaType QMetaSequence::valueMetaType() const
コンテナに格納されている値のメタ型を返します。
関連する非会員
[noexcept, since 6.0]
bool operator!=(const QMetaSequence &lhs, const QMetaSequence &rhs)
QMetaSequence lhs がQMetaSequence rhs と異なるコンテナタイプを表している場合はtrue
を返し、そうでない場合はfalse
を返します。
この関数は Qt 6.0 で導入されました。
[noexcept, since 6.0]
bool operator==(const QMetaSequence &lhs, const QMetaSequence &rhs)
QMetaSequence lhs がQMetaSequence rhs と同じコンテナ型を表している場合はtrue
を返し、そうでない場合はfalse
を返します。
この関数は Qt 6.0 で導入されました。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.