const_iterator Class
class QJsonObject::const_iteratorDie Klasse QJsonObject::const_iterator bietet einen STL-ähnlichen Konst-Iterator für QJsonObject. Mehr...
- Liste aller Mitglieder, einschließlich geerbter Mitglieder
- const_iterator ist Teil der JSON-Unterstützung in Qt.
Diese Klasse ist stark vergleichbar.
Diese Klasse ist stark vergleichbar mit QJsonObject::iterator.
Öffentliche Typen
Öffentliche Funktionen
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 |
Verwandte Nicht-Mitglieder
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) |
Detaillierte Beschreibung
QJsonObject::const_iterator ermöglicht es Ihnen, über eine QJsonObject zu iterieren. Wenn Sie die QJsonObject während der Iteration ändern möchten, müssen Sie stattdessen QJsonObject::iterator verwenden. Es ist im Allgemeinen eine gute Praxis, QJsonObject::const_iterator auch für eine Nicht-Konstante QJsonObject zu verwenden, es sei denn, Sie müssen die QJsonObject durch den Iterator ändern. Konstante Iteratoren sind etwas schneller und verbessern die Lesbarkeit des Codes.
Der Standard QJsonObject::const_iterator Konstruktor erzeugt einen nicht initialisierten Iterator. Sie müssen ihn mit einer QJsonObject Funktion wie QJsonObject::constBegin(), QJsonObject::constEnd(), oder QJsonObject::find() initialisieren, bevor Sie mit der Iteration beginnen können.
Mehrere Iteratoren können für dasselbe Objekt verwendet werden. Vorhandene Iteratoren werden jedoch hängen bleiben, wenn das Objekt geändert wird.
Siehe auch QJsonObject::iterator, JSON-Unterstützung in Qt, und Speichern und Laden eines Spiels.
Dokumentation der Mitgliedstypen
const_iterator::iterator_category
Ein Synonym für std::random_access_iterator_tag, das anzeigt, dass dieser Iterator ein Iterator mit wahlfreiem Zugriff ist.
Hinweis: In Qt-Versionen vor 5.6 wurde dies fälschlicherweise auf std::bidirectional_iterator_tag gesetzt.
Dokumentation der Mitgliedsfunktionen
const_iterator::const_iterator()
Konstruiert einen uninitialisierten Iterator.
Funktionen wie key(), value() und operator++() dürfen nicht mit einem nicht initialisierten Iterator aufgerufen werden. Verwenden Sie operator=(), um ihm einen Wert zuzuweisen, bevor Sie ihn verwenden.
Siehe auch QJsonObject::constBegin() und QJsonObject::constEnd().
const_iterator::const_iterator(const QJsonObject::iterator &other)
Konstruiert eine Kopie von other.
QString const_iterator::key() const
Gibt den Schlüssel des aktuellen Elements zurück.
Siehe auch value().
QJsonValueConstRef const_iterator::value() const
Gibt den Wert des aktuellen Elements zurück.
Siehe auch key() und operator*().
const QJsonValueConstRef const_iterator::operator*() const
Gibt den Wert des aktuellen Elements zurück.
Dasselbe wie value().
Siehe auch key().
QJsonObject::const_iterator const_iterator::operator+(qsizetype j) const
Gibt einen Iterator zu dem Element an j Positionen vor diesem Iterator zurück. Wenn j negativ ist, geht der Iterator rückwärts.
Dieser Vorgang kann bei großen j Werten langsam sein.
Siehe auch operator-().
QJsonObject::const_iterator &const_iterator::operator++()
Der Präfix-Operator ++
( ++i
) setzt den Iterator auf das nächste Element im Objekt und gibt einen Iterator auf das neue aktuelle Element zurück.
Der Aufruf dieser Funktion auf QJsonObject::end() führt zu undefinierten Ergebnissen.
Siehe auch operator--().
QJsonObject::const_iterator const_iterator::operator++(int)
Dies ist eine überladene Funktion.
Der Postfix-Operator ++
, i++
, setzt den Iterator auf das nächste Element im Objekt und gibt einen Iterator auf das zuvor aktuelle Element zurück.
QJsonObject::const_iterator &const_iterator::operator+=(qsizetype j)
Bringt den Iterator um j Elemente weiter. Wenn j negativ ist, geht der Iterator rückwärts.
Dieser Vorgang kann bei großen j Werten langsam sein.
Siehe auch operator-=() und operator+().
qsizetype const_iterator::operator-(QJsonObject::const_iterator other) const
Gibt die Anzahl der Elemente zwischen dem Element, auf das other zeigt, und dem Element, auf das dieser Iterator zeigt, zurück.
QJsonObject::const_iterator const_iterator::operator-(qsizetype j) const
Gibt einen Iterator zu dem Element an j Positionen rückwärts von diesem Iterator zurück. Wenn j negativ ist, geht der Iterator vorwärts.
Dieser Vorgang kann bei großen j Werten langsam sein.
Siehe auch operator+().
QJsonObject::const_iterator &const_iterator::operator--()
Der Präfix-Operator --
, --i
, macht das vorhergehende Element aktuell und gibt einen Iterator zurück, der auf das neue aktuelle Element zeigt.
Der Aufruf dieser Funktion auf QJsonObject::begin() führt zu undefinierten Ergebnissen.
Siehe auch operator++().
QJsonObject::const_iterator const_iterator::operator--(int)
Dies ist eine überladene Funktion.
Der Postfix-Operator --
, i--
, macht das vorhergehende Element aktuell und gibt einen Iterator zurück, der auf das zuvor aktuelle Element zeigt.
QJsonObject::const_iterator &const_iterator::operator-=(qsizetype j)
Bringt den Iterator dazu, um j Elemente zurück zu gehen. Wenn j negativ ist, geht der Iterator vorwärts.
Dieser Vorgang kann bei großen j Werten langsam sein.
Siehe auch operator+=() und operator-().
const QJsonValueConstRef *const_iterator::operator->() const
Gibt einen Zeiger auf das aktuelle Element zurück.
QJsonValueConstRef const_iterator::operator[](qsizetype j) const
Gibt das Element am Offset j von dem Element zurück, auf das dieser Iterator zeigt (das Element an Position *this + j
).
Diese Funktion wird bereitgestellt, damit sich QJsonObject Iteratoren wie C++-Zeiger verhalten.
Siehe auch operator+().
Verwandte Nicht-Mitglieder
[noexcept]
bool operator!=(const QJsonObject::const_iterator &lhs, const QJsonObject::const_iterator &rhs)
Gibt true
zurück, wenn lhs auf ein anderes Element als rhs iterator zeigt; andernfalls gibt false
zurück.
Siehe auch operator==().
[noexcept]
bool operator<(const QJsonObject::const_iterator &lhs, const QJsonObject::const_iterator &rhs)
Gibt true
zurück, wenn das Element, auf das der Iterator lhs zeigt, kleiner ist als das Element, auf das der Iterator rhs zeigt.
[noexcept]
bool operator<=(const QJsonObject::const_iterator &lhs, const QJsonObject::const_iterator &rhs)
Gibt true
zurück, wenn das Element, auf das der Iterator lhs zeigt, kleiner oder gleich dem Element ist, auf das der Iterator rhs zeigt.
[noexcept]
bool operator==(const QJsonObject::const_iterator &lhs, const QJsonObject::const_iterator &rhs)
Gibt true
zurück, wenn lhs auf dasselbe Element wie der Iterator rhs zeigt; andernfalls wird false
zurückgegeben.
Siehe auch operator!=().
[noexcept]
bool operator>(const QJsonObject::const_iterator &lhs, const QJsonObject::const_iterator &rhs)
Gibt true
zurück, wenn das Element, auf das der Iterator lhs zeigt, größer ist als das Element, auf das der Iterator rhs zeigt.
[noexcept]
bool operator>=(const QJsonObject::const_iterator &lhs, const QJsonObject::const_iterator &rhs)
Gibt true
zurück, wenn das Element, auf das der Iterator lhs zeigt, größer oder gleich dem Element ist, auf das der Iterator rhs zeigt.
© 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.