iterator Class

class QJsonArray::iterator

QJsonArray::iterator クラスは、QJsonArray 用の STL スタイルの非 const イテレータを提供します。詳細...

このクラスは強く比較可能です。

このクラスはQJsonArray::const_iterator強く比較可能です。

パブリック型

パブリック関数

iterator()
QJsonValueRef operator*() const
QJsonArray::iterator operator+(qsizetype j) const
QJsonArray::iterator &operator++()
QJsonArray::iterator operator++(int)
QJsonArray::iterator &operator+=(qsizetype j)
qsizetype operator-(QJsonArray::iterator other) const
QJsonArray::iterator operator-(qsizetype j) const
QJsonArray::iterator &operator--()
QJsonArray::iterator operator--(int)
QJsonArray::iterator &operator-=(qsizetype j)
const QJsonValueConstRef *operator->() const
QJsonValueRef operator[](qsizetype j) const
bool operator!=(const QJsonArray::iterator &lhs, const QJsonArray::const_iterator &rhs)
bool operator!=(const QJsonArray::iterator &lhs, const QJsonArray::iterator &rhs)
bool operator<(const QJsonArray::iterator &lhs, const QJsonArray::const_iterator &rhs)
bool operator<(const QJsonArray::iterator &lhs, const QJsonArray::iterator &rhs)
bool operator<=(const QJsonArray::iterator &lhs, const QJsonArray::const_iterator &rhs)
bool operator<=(const QJsonArray::iterator &lhs, const QJsonArray::iterator &rhs)
bool operator==(const QJsonArray::iterator &lhs, const QJsonArray::const_iterator &rhs)
bool operator==(const QJsonArray::iterator &lhs, const QJsonArray::iterator &rhs)
bool operator>(const QJsonArray::iterator &lhs, const QJsonArray::const_iterator &rhs)
bool operator>(const QJsonArray::iterator &lhs, const QJsonArray::iterator &rhs)
bool operator>=(const QJsonArray::iterator &lhs, const QJsonArray::const_iterator &rhs)
bool operator>=(const QJsonArray::iterator &lhs, const QJsonArray::iterator &rhs)

詳細説明

QJsonArray::iterator QJsonArray を繰り返し処理し、イテレータに関連付けられた配列項目を変更することができます。const に対して反復処理を行いたい場合は、代わりに を使用してください。イテレータを通して を変更する必要がない限り、const でない に対しても を使用するのが一般的です。const イテレータの方が若干高速で、コードの可読性も向上します。QJsonArray QJsonArray::const_iterator QJsonArray QJsonArray QJsonArray::const_iterator

デフォルトのQJsonArray::iterator コンストラクタは、初期化されていないイテレータを作成します。QJsonArray::begin ()、QJsonArray::end ()、QJsonArray::insert ()のようなQJsonArray 関数を使用して初期化しなければなりません。

ほとんどのQJsonArray 関数は、イテレータではなく整数インデックスを受け付けます。そのため、QJsonArray に関しては、イテレータはほとんど役に立ちません。STLスタイルのイテレータが意味を持つ場所の1つは、generic algorithms への引数です。

同じ配列に対して複数の反復子を使用することができます。ただし、QJsonArray に対して const 以外の関数を呼び出すと、既存のイテレータがすべて未定義になることに注意してください。

QJsonArray::const_iteratorも参照してください

メンバ型ドキュメント

iterator::iterator_category

このイテレータがランダムアクセスイテレータであることを示すstd::random_access_iterator_tagのシノニム。

メンバ関数ドキュメント

iterator::iterator()

初期化されていないイテレータを構築します。

operator*() や operator++() のような関数を、初期化されていないイテレータに対して呼び出してはいけません。operator=() を使用して値を代入してから使用してください。

QJsonArray::begin() およびQJsonArray::end()も参照してください

QJsonValueRef iterator::operator*() const

現在の項目への変更可能な参照を返します。

項目の値を変更するには、代入の左辺で operator*() を使用します。

戻り値は、QJsonArray およびQJsonObject のヘルパー・クラスであるQJsonValueRef 型です。QJsonValueRef 型のオブジェクトを取得すると、それをあたかもQJsonValue への参照であるかのように使用できます。これに代入すると、その代入は、参照を取得したQJsonObjectQJsonArray の文字に適用されます。

QJsonArray::iterator iterator::operator+(qsizetype j) const

このイテレータからj 前方の位置のアイテムへのイテレータを返します。j が負の場合、イテレータは後方に進みます。

operator-() およびoperator+=()も参照

QJsonArray::iterator &iterator::operator++()

++it前置演算子++ は、イテレータを配列の次の項目に進め、新しい現在の項目へのイテレータを返す。

この関数をQJsonArray::end() で呼び出すと、未定義の結果になります。

operator--()も参照

QJsonArray::iterator iterator::operator++(int)

これはオーバーロードされた関数である。

ポストフィックス++ 演算子it++ は、イテレータを配列の次の項目に進め、それ以前の現在の項目へのイテレータを返します。

QJsonArray::iterator &iterator::operator+=(qsizetype j)

イテレータをj アイテム分進めます。j が負の場合、イテレータは後退する。

operator-=() およびoperator+()も参照のこと

qsizetype iterator::operator-(QJsonArray::iterator other) const

other が指すアイテムとこのイテレータが指すアイテムの間のアイテム数を返します。

QJsonArray::iterator iterator::operator-(qsizetype j) const

このイテレータからj 後方の位置のアイテムへのイテレータを返します。j が負の場合、イテレータは前方に進みます。

operator+() およびoperator-=()も参照

QJsonArray::iterator &iterator::operator--()

接頭辞-- 演算子--it は、直前の項目をカレントとし、新しいカレント項目へのイテレータを返す。

この関数をQJsonArray::begin() で呼び出すと、未定義の結果になります。

operator++()も参照

QJsonArray::iterator iterator::operator--(int)

これはオーバーロードされた関数である。

ポストフィックス-- 演算子、it-- は、直前の項目をカレントにし、直前の項目へのイテレータを返します。

QJsonArray::iterator &iterator::operator-=(qsizetype j)

イテレータをj アイテム分戻します。j が負の場合、イテレータは前に進みます。

operator+=() およびoperator-()も参照

const QJsonValueConstRef *iterator::operator->() const

現在のアイテムへの変更可能な参照へのポインタを返します。

QJsonValueRef iterator::operator[](qsizetype j) const

このイテレータが指すアイテム(位置*this + j のアイテム)からオフセットj にあるアイテムへの変更可能な参照を返します。

この関数は、QJsonArray イテレータを C++ ポインタのように動作させるために用意されています。

戻り値は、QJsonArray およびQJsonObject のヘルパー・クラスであるQJsonValueRef 型です。QJsonValueRef 型のオブジェクトを取得すると、それをQJsonValue への参照であるかのように使用できます。これに代入すると、その代入は、参照を取得したQJsonArray またはQJsonObject の要素に適用されます。

operator+()も参照してください

関連する非メンバー

[noexcept] bool operator==(const QJsonArray::iterator &lhs, const QJsonArray::const_iterator &rhs)

[noexcept] bool operator==(const QJsonArray::iterator &lhs, const QJsonArray::iterator &rhs)

lhs がイテレータrhs と同じアイテムを指している場合はtrue を返し、そうでない場合はfalse を返す。

operator!=()も参照

[noexcept] bool operator!=(const QJsonArray::iterator &lhs, const QJsonArray::const_iterator &rhs)

[noexcept] bool operator!=(const QJsonArray::iterator &lhs, const QJsonArray::iterator &rhs)

lhs がイテレータrhs と異なるアイテムを指している場合はtrue を返し、そうでない場合はfalse を返す。

operator==()も参照

[noexcept] bool operator<(const QJsonArray::iterator &lhs, const QJsonArray::const_iterator &rhs)

[noexcept] bool operator<(const QJsonArray::iterator &lhs, const QJsonArray::iterator &rhs)

lhs イテレータが指すアイテムが、rhs イテレータが指すアイテムより小さい場合、true を返す。

[noexcept] bool operator<=(const QJsonArray::iterator &lhs, const QJsonArray::const_iterator &rhs)

[noexcept] bool operator<=(const QJsonArray::iterator &lhs, const QJsonArray::iterator &rhs)

lhs イテレータが指すアイテムが、rhs イテレータが指すアイテム以下である場合、true を返す。

[noexcept] bool operator>(const QJsonArray::iterator &lhs, const QJsonArray::const_iterator &rhs)

[noexcept] bool operator>(const QJsonArray::iterator &lhs, const QJsonArray::iterator &rhs)

lhs イテレータが指すアイテムが、rhs イテレータが指すアイテムより大きい場合、true を返す。

[noexcept] bool operator>=(const QJsonArray::iterator &lhs, const QJsonArray::const_iterator &rhs)

[noexcept] bool operator>=(const QJsonArray::iterator &lhs, const QJsonArray::iterator &rhs)

lhs イテレータが指すアイテムが、rhs イテレータが指すアイテム以上であれば、true を返す。

© 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.