QJsonObject::const_iterator Class
class QJsonObject::const_iteratorQJsonObject::const_iterator クラスは、QJsonObject 用のSTLスタイルのconstイテレータを提供します。詳細...
- 継承されたメンバーを含む、すべてのメンバーの一覧
- const_iterator は、Qt の JSON サポートの一部です。
QJsonObject::const_iterator の比較
| カテゴリ | 比較可能な型 |
|---|---|
| strong | QJsonObject::const_iterator |
| strong | QJsonObject::iterator. |
パブリック型
パブリック関数
| const_iterator() | |
| const_iterator(const QJsonObject::iterator &other) | |
| const_iterator(const QJsonObject::const_iterator &other) | |
| QString | key() const |
(since 6.10) QAnyStringView | keyView() const |
| QJsonValueConstRef | value() const |
| const QJsonValueConstRef | operator*() const |
| QJsonObject::const_iterator | operator+(qsizetype j) const |
| QJsonObject::const_iterator & | operator++() |
| QJsonObject::const_iterator | operator++(int) |
| QJsonObject::const_iterator & | operator+=(qsizetype j) |
| qsizetype | operator-(QJsonObject::const_iterator other) const |
| QJsonObject::const_iterator | operator-(qsizetype j) const |
| QJsonObject::const_iterator & | operator--() |
| QJsonObject::const_iterator | operator--(int) |
| QJsonObject::const_iterator & | operator-=(qsizetype j) |
| const QJsonValueConstRef * | operator->() const |
| QJsonValueConstRef | operator[](qsizetype j) const |
関連する非メンバー
| bool | operator!=(const QJsonObject::const_iterator &lhs, const QJsonObject::const_iterator &rhs) |
| bool | operator<(const QJsonObject::const_iterator &lhs, const QJsonObject::const_iterator &rhs) |
| bool | operator<=(const QJsonObject::const_iterator &lhs, const QJsonObject::const_iterator &rhs) |
| bool | operator==(const QJsonObject::const_iterator &lhs, const QJsonObject::const_iterator &rhs) |
| bool | operator>(const QJsonObject::const_iterator &lhs, const QJsonObject::const_iterator &rhs) |
| bool | operator>=(const QJsonObject::const_iterator &lhs, const QJsonObject::const_iterator &rhs) |
詳細な説明
QJsonObject::const_iterator QJsonObject を反復処理できます。反復処理中に を変更したい場合は、代わりに を使用する必要があります。また、イテレータを介して を変更する必要がない限り、非constの に対しても を使用するのが一般的なベストプラクティスです。constイテレータはわずかに高速であり、コードの可読性を向上させます。QJsonObject QJsonObject::iterator QJsonObject QJsonObject QJsonObject::const_iterator
QJsonObject::const_iterator のデフォルトコンストラクタは、初期化されていないイテレータを作成します。反復処理を開始する前に、QJsonObject::constBegin()、QJsonObject::constEnd()、またはQJsonObject::find()などのQJsonObject 関数を使用して、イテレータを初期化する必要があります。
同じオブジェクトに対して複数のイテレータを使用することができます。ただし、オブジェクトが変更されると、既存のイテレータはダングリング状態になります。
「 QJsonObject::iterator 」、「Qt XML における JSON サポート」、「ゲームの保存と読み込み」も参照してください 。
メンバ型のドキュメント
const_iterator::iterator_category
このイテレータがランダムアクセス・イテレータであることを示す、std::random_access_iterator_tagの同義語。
注: Qt 5.6 以前のバージョンでは 、これが誤ってstd::bidirectional_iterator_tag に設定されていました。
メンバ関数のドキュメント
const_iterator::const_iterator()
初期化されていないイテレータを生成します。
key()、value()、およびoperator++() などの関数は、初期化されていないイテレータに対して呼び出してはなりません。使用する前に、operator=() を使用して値を代入してください。
QJsonObject::constBegin() およびQJsonObject::constEnd()も参照してください 。
const_iterator::const_iterator(const QJsonObject::iterator &other)
other のコピーを作成します。
[constexpr noexcept default] const_iterator::const_iterator(const QJsonObject::const_iterator &other)
const_iterator のインスタンスをコピーして生成します。
QString const_iterator::key() const
現在の項目のキーを返します。
value() およびkeyView()も参照してください 。
[since 6.10] QAnyStringView const_iterator::keyView() const
現在の項目のキーをQAnyStringView として返します。この関数はメモリを割り当てません。
QJsonObject はキーをUS-ASCII、UTF-8、またはUTF-16で格納するため、返されるQAnyStringView はこれらのエンコーディングのいずれかになる可能性があります。
この関数は Qt 6.10 で導入されました。
QJsonValueConstRef const_iterator::value() const
現在の項目の値を返します。
key()、keyView()、およびoperator*()も参照してください 。
const QJsonValueConstRef const_iterator::operator*() const
現在の項目の値を返します。
value() と同じです。
QJsonObject::const_iterator const_iterator::operator+(qsizetype j) const
このイテレータからj の位置だけ先にある項目へのイテレータを返します。j が負の値の場合、イテレータは後方へ移動します。
j の値が大きい場合、この操作は処理に時間がかかることがあります。
operator-()も参照してください 。
QJsonObject::const_iterator &const_iterator::operator++()
プレフィックス演算子 `++ `(++i )は、イテレータをオブジェクト内の次の項目へと進め、新しい現在の項目へのイテレータを返します。
QJsonObject::end() に対してこの関数を呼び出すと、未定義の結果となります。
operator--()も参照してください 。
QJsonObject::const_iterator const_iterator::operator++(int)
後置演算子++ (i++ )は、イテレータをオブジェクト内の次の項目へ進め、直前に現在位置にあった項目へのイテレータを返します。
これはオーバーロードされた関数です。
QJsonObject::const_iterator &const_iterator::operator+=(qsizetype j)
イテレータをj 個分進めます。j が負の場合、イテレータは後退します。
j の値が大きい場合、この操作の処理に時間がかかることがあります。
operator-=() およびoperator+()も参照してください 。
qsizetype const_iterator::operator-(QJsonObject::const_iterator other) const
other が指す項目と、このイテレータが指す項目の間の項目の数を返します。
QJsonObject::const_iterator const_iterator::operator-(qsizetype j) const
このイテレータからj の位置分だけ後ろにある項目へのイテレータを返します。j が負の値の場合、イテレータは前方へ移動します。
j の値が大きい場合、この操作は処理に時間がかかることがあります。
operator+()も参照してください 。
QJsonObject::const_iterator &const_iterator::operator--()
プレフィックス演算子 `-- `(--i )は、直前の要素を現在の要素として設定し、新しい現在の要素を指すイテレータを返します。
QJsonObject::begin() に対してこの関数を呼び出すと、未定義の結果となります。
operator++()も参照してください 。
QJsonObject::const_iterator const_iterator::operator--(int)
後置演算子-- (i-- )は、直前の要素を現在の要素とし、直前に現在の要素だった要素を指すイテレータを返します。
これはオーバーロードされた関数です。
QJsonObject::const_iterator &const_iterator::operator-=(qsizetype j)
イテレータをj 個分戻します。j が負の値の場合、イテレータは前進します。
j の値が大きい場合、この操作には時間がかかることがあります。
operator+=() およびoperator-()も参照してください 。
const QJsonValueConstRef *const_iterator::operator->() const
現在の項目へのポインタを返します。
QJsonValueConstRef const_iterator::operator[](qsizetype j) const
このイテレータが指す項目(位置*this + j にある項目)から、オフセットj の位置にある項目を返します。
この関数は、QJsonObject イテレータが C++ のポインタのように動作するようにするために提供されています。
operator+()も参照してください 。
関連する非メンバ関数
[noexcept] bool operator!=(const QJsonObject::const_iterator &lhs, const QJsonObject::const_iterator &rhs)
lhs がrhs のイテレータとは異なる項目を指している場合はtrue を返し、そうでない場合はfalse を返します。
operator==()も参照してください 。
[noexcept] bool operator<(const QJsonObject::const_iterator &lhs, const QJsonObject::const_iterator &rhs)
lhs イテレータが指す要素が、rhs イテレータが指す要素よりも小さい場合、true を返します。
[noexcept] bool operator<=(const QJsonObject::const_iterator &lhs, const QJsonObject::const_iterator &rhs)
lhs イテレータが指す項目が、rhs イテレータが指す項目以下である場合、true を返します。
[noexcept] bool operator==(const QJsonObject::const_iterator &lhs, const QJsonObject::const_iterator &rhs)
lhs がrhs のイテレータと同じ項目を指している場合はtrue を返し、そうでない場合はfalse を返します。
operator!=()も参照してください 。
[noexcept] bool operator>(const QJsonObject::const_iterator &lhs, const QJsonObject::const_iterator &rhs)
lhs イテレータが指す項目が、rhs イテレータが指す項目よりも大きい場合、true を返します。
[noexcept] bool operator>=(const QJsonObject::const_iterator &lhs, const QJsonObject::const_iterator &rhs)
lhs イテレータが指すアイテムが、rhs イテレータが指すアイテム以上である場合、true を返します。
© 2026 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.