QJsonArray::iterator Class
class QJsonArray::iteratorLa classe ` QJsonArray::iterator ` fornisce un iteratore non costante in stile STL per ` QJsonArray`. Per saperne di più...
Confronto tra QJsonArray::iterator
| Categoria | Tipi comparabili |
|---|---|
| strong | QJsonArray::iterator |
| strong | QJsonArray::const_iterator. |
Tipi pubblici
Funzioni pubbliche
| iterator() | |
| iterator(const QJsonArray::iterator &other) | |
| 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 |
Elementi non membri correlati
| 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) |
Descrizione dettagliata
QJsonArray::iterator consente di iterare su un ` QJsonArray ` e di modificare l'elemento dell'array associato all'iteratore. Se si desidera iterare su un `const QJsonArray`, utilizzare invece ` QJsonArray::const_iterator `. In genere è buona norma utilizzare ` QJsonArray::const_iterator ` anche su un `non-const QJsonArray `, a meno che non sia necessario modificare l'` QJsonArray ` tramite l'iteratore. Gli iteratori costanti sono leggermente più veloci e migliorano la leggibilità del codice.
Il costruttore predefinito di ` QJsonArray::iterator ` crea un iteratore non inizializzato. È necessario inizializzarlo utilizzando una funzione ` QJsonArray ` come ` QJsonArray::begin()`, ` QJsonArray::end()` o ` QJsonArray::insert()` prima di poter iniziare l'iterazione.
La maggior parte delle funzioni QJsonArray accetta un indice intero anziché un iteratore. Per questo motivo, gli iteratori sono raramente utili in combinazione con QJsonArray. Un caso in cui gli iteratori in stile STL hanno senso è come argomenti di generic algorithms.
È possibile utilizzare più iteratori sullo stesso array. Tuttavia, occorre tenere presente che qualsiasi chiamata a una funzione non const eseguita sull’ QJsonArray renderà indefiniti tutti gli iteratori esistenti.
Vedi anche QJsonArray::const_iterator.
Documentazione sui tipi dei membri
iterator::iterator_category
Sinonimo di std::random_access_iterator_tag che indica che questo iteratore è un iteratore ad accesso casuale.
Documentazione delle funzioni membro
iterator::iterator()
Crea un iteratore non inizializzato.
Funzioni come operator*() e operator++() non dovrebbero essere chiamate su un iteratore non inizializzato. Utilizzare operator=() per assegnargli un valore prima di utilizzarlo.
Vedi anche QJsonArray::begin() e QJsonArray::end().
[constexpr noexcept default] iterator::iterator(const QJsonArray::iterator &other)
Crea un'istanza di ` iterator` tramite copia.
QJsonValueRef iterator::operator*() const
Restituisce un riferimento modificabile all'elemento corrente.
È possibile modificare il valore di un elemento utilizzando l'operatore *() sul lato sinistro di un'assegnazione.
Il valore restituito è di tipo ` QJsonValueRef`, una classe di supporto per ` QJsonArray ` e ` QJsonObject`. Quando si ottiene un oggetto di tipo ` QJsonValueRef`, è possibile utilizzarlo come se fosse un riferimento a un ` QJsonValue`. Se gli si assegna un valore, l'assegnazione si applicherà al carattere contenuto in ` QJsonArray ` di ` QJsonObject ` da cui è stato ottenuto il riferimento.
QJsonArray::iterator iterator::operator+(qsizetype j) const
Restituisce un iteratore che punta all'elemento situato a j posizioni in avanti rispetto a questo iteratore. Se j è negativo, l'iteratore si sposta all'indietro.
Vedi anche operator-() e operator+=().
QJsonArray::iterator &iterator::operator++()
L'operatore con prefisso ++, ++it, fa avanzare l'iteratore all'elemento successivo dell'array e restituisce un iteratore puntante al nuovo elemento corrente.
La chiamata a questa funzione su QJsonArray::end() produce risultati indefiniti.
Vedi anche operator--().
QJsonArray::iterator iterator::operator++(int)
L'operatore postfisso ++, it++, fa avanzare l'iteratore all'elemento successivo dell'array e restituisce un iteratore all'elemento precedentemente selezionato.
Si tratta di una funzione sovraccaricata.
QJsonArray::iterator &iterator::operator+=(qsizetype j)
Fai avanzare l'iteratore di j elementi. Se j è negativo, l'iteratore va all'indietro.
Vedi anche ` operator-=()` e ` operator+()`.
qsizetype iterator::operator-(QJsonArray::iterator other) const
Restituisce il numero di elementi compresi tra l'elemento indicato dall'other e e l'elemento indicato da questo iteratore.
QJsonArray::iterator iterator::operator-(qsizetype j) const
Restituisce un iteratore che punta all’elemento situato a j posizioni indietro rispetto a questo iteratore. Se j è negativo, l’iteratore si sposta in avanti.
Vedi anche operator+() e operator-=().
QJsonArray::iterator &iterator::operator--()
L'operatore prefissato --, --it, imposta l'elemento precedente come corrente e restituisce un iteratore al nuovo elemento corrente.
La chiamata a questa funzione su ` QJsonArray::begin()` produce risultati indefiniti.
Vedi anche operator++().
QJsonArray::iterator iterator::operator--(int)
L'operatore postfisso --, it--, rende l'elemento precedente l'elemento corrente e restituisce un iteratore all'elemento che era precedentemente corrente.
Si tratta di una funzione sovraccaricata.
QJsonArray::iterator &iterator::operator-=(qsizetype j)
Fa tornare indietro l'iteratore di j elementi. Se j è negativo, l'iteratore va avanti.
Vedi anche operator+=() e operator-().
const QJsonValueConstRef *iterator::operator->() const
Restituisce un puntatore a un riferimento modificabile all'elemento corrente.
QJsonValueRef iterator::operator[](qsizetype j) const
Restituisce un riferimento modificabile all'elemento all'offset j a partire dall'elemento indicato da questo iteratore (l'elemento in posizione *this + j).
Questa funzione è fornita per far sì che gli iteratori QJsonArray si comportino come puntatori C++.
Il valore restituito è di tipo QJsonValueRef, una classe di supporto per QJsonArray e QJsonObject. Quando si ottiene un oggetto di tipo QJsonValueRef, è possibile utilizzarlo come se fosse un riferimento a un QJsonValue. Se gli si assegna un valore, l'assegnazione si applicherà all'elemento in QJsonArray o QJsonObject da cui è stato ottenuto il riferimento.
Vedi anche operator+().
Elementi non membri correlati
[noexcept] bool operator!=(const QJsonArray::iterator &lhs, const QJsonArray::const_iterator &rhs)
[noexcept] bool operator!=(const QJsonArray::iterator &lhs, const QJsonArray::iterator &rhs)
Restituisce ` true ` se ` lhs ` punta a un elemento diverso dall'iteratore ` rhs `; altrimenti restituisce ` false`.
Vedi anche operator==().
[noexcept] bool operator<(const QJsonArray::iterator &lhs, const QJsonArray::const_iterator &rhs)
[noexcept] bool operator<(const QJsonArray::iterator &lhs, const QJsonArray::iterator &rhs)
Restituisce ` true ` se l'elemento indicato dall'iteratore ` lhs ` è minore dell'elemento indicato dall'iteratore ` rhs `.
[noexcept] bool operator<=(const QJsonArray::iterator &lhs, const QJsonArray::const_iterator &rhs)
[noexcept] bool operator<=(const QJsonArray::iterator &lhs, const QJsonArray::iterator &rhs)
Restituisce ` true ` se l'elemento a cui punta l'iteratore ` lhs ` è minore o uguale all'elemento a cui punta l'iteratore ` rhs `.
[noexcept] bool operator==(const QJsonArray::iterator &lhs, const QJsonArray::const_iterator &rhs)
[noexcept] bool operator==(const QJsonArray::iterator &lhs, const QJsonArray::iterator &rhs)
Restituisce ` true ` se ` lhs ` punta allo stesso elemento dell'iteratore ` rhs `; altrimenti restituisce ` false`.
Vedi anche operator!=().
[noexcept] bool operator>(const QJsonArray::iterator &lhs, const QJsonArray::const_iterator &rhs)
[noexcept] bool operator>(const QJsonArray::iterator &lhs, const QJsonArray::iterator &rhs)
Restituisce ` true ` se l'elemento indicato dall'iteratore ` lhs ` è maggiore dell'elemento indicato dall'iteratore ` rhs `.
[noexcept] bool operator>=(const QJsonArray::iterator &lhs, const QJsonArray::const_iterator &rhs)
[noexcept] bool operator>=(const QJsonArray::iterator &lhs, const QJsonArray::iterator &rhs)
Restituisce ` true ` se l'elemento indicato dall'iteratore ` lhs ` è maggiore o uguale all'elemento indicato dall'iteratore ` rhs `.
© 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.