const_iterator Class

class QJsonObject::const_iterator

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

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

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

パブリック型

パブリック関数

const_iterator()
const_iterator(const QJsonObject::iterator &other)
QString key() 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 を使用すると、 を繰り返し処理することができます。 を繰り返し処理しながら変更したい場合は、代わりに を使用する必要があります。イテレータを通して を変更する必要がない限り、const 以外でも を使用するのが一般的です。constイテレータの方が若干高速で、コードの可読性も向上します。QJsonObject QJsonObject QJsonObject::iterator QJsonObject QJsonObject QJsonObject::const_iterator

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

同じオブジェクトに複数のイテレータを使用することができます。ただし、オブジェクトが変更されると、既存のイテレータはぶら下がった状態になります。

QJsonObject::iteratorQtの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 のコピーを作成する。

QString const_iterator::key() const

現在のアイテムのキーを返します。

value()も参照

QJsonValueConstRef const_iterator::value() const

現在の項目の値を返します。

key() およびoperator*()も参照

const QJsonValueConstRef const_iterator::operator*() const

現在の項目の値を返します。

value() と同じ。

key()も参照

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 を返す。

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