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 를 사용하면 QJsonObject 를 반복할 수 있습니다. QJsonObject 을 반복하면서 수정하려면 QJsonObject::iterator 을 대신 사용해야 합니다. 이터레이터를 통해 QJsonObject 을 변경해야 하는 경우가 아니라면, 일반적으로 생성자가 아닌 QJsonObject 에도 QJsonObject::const_iterator 을 사용하는 것이 좋습니다. Const 이터레이터는 약간 더 빠르며 코드 가독성이 향상됩니다.

기본 QJsonObject::const_iterator 생성자는 초기화되지 않은 이터레이터를 생성합니다. QJsonObject::constBegin (), QJsonObject::constEnd() 또는 QJsonObject::find()와 같은 QJsonObject 함수를 사용하여 초기화해야 반복을 시작할 수 있습니다.

동일한 객체에서 여러 개의 이터레이터를 사용할 수 있습니다. 그러나 객체가 수정되면 기존 이터레이터는 매달리게 됩니다.

또한 QJsonObject::iterator, Qt의 JSON 지원, 게임 저장 및 불러오기를참조하십시오 .

멤버 유형 문서

const_iterator::iterator_category

이 이터레이터가 무작위 액세스 이터레이터임을 나타내는 std::random_access_iterator_tag의 동의어입니다.

참고: 5.6 이전 Qt 버전에서는, 이것은 실수로 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)

lhsrhs 이터레이터와 다른 항목을 가리키면 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)

lhsrhs 이터레이터와 동일한 항목을 가리키면 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.