QCborMap::Iterator Class
class QCborMap::IteratorLa classe ` QCborMap::Iterator ` fornisce un iteratore non costante in stile STL per ` QCborMap`. Per saperne di più...
- Elenco di tutti i membri, compresi quelli ereditati
- L'iteratore fa parte del supporto CBOR in Qt.
Confronto tra QCborMap::Iterator
| Categoria | Tipi comparabili |
|---|---|
| strong | QCborMap::Iterator |
| strong | ConstIterator. |
Tipi pubblici
Funzioni pubbliche
| Iterator() | |
| Iterator(const QCborMap::Iterator &other) | |
| ~Iterator() | |
| QCborValue | key() const |
| QCborValueRef | value() const |
| QCborMap::Iterator::value_type | operator*() const |
| QCborMap::Iterator | operator+(qsizetype j) const |
| QCborMap::Iterator & | operator++() |
| QCborMap::Iterator | operator++(int) |
| QCborMap::Iterator & | operator+=(qsizetype j) |
| qsizetype | operator-(QCborMap::Iterator j) const |
| QCborMap::Iterator | operator-(qsizetype j) const |
| QCborMap::Iterator & | operator--() |
| QCborMap::Iterator | operator--(int) |
| QCborMap::Iterator & | operator-=(qsizetype j) |
| const QCborValueConstRef * | operator->() const |
| QCborMap::Iterator & | operator=(const QCborMap::Iterator &other) |
Elementi non membri correlati
| bool | operator!=(const QCborMap::Iterator &lhs, const QCborMap::ConstIterator &rhs) |
| bool | operator!=(const QCborMap::Iterator &lhs, const QCborMap::Iterator &rhs) |
| bool | operator<(const QCborMap::Iterator &lhs, const QCborMap::ConstIterator &rhs) |
| bool | operator<(const QCborMap::Iterator &lhs, const QCborMap::Iterator &rhs) |
| bool | operator<=(const QCborMap::Iterator &lhs, const QCborMap::ConstIterator &rhs) |
| bool | operator<=(const QCborMap::Iterator &lhs, const QCborMap::Iterator &rhs) |
| bool | operator==(const QCborMap::Iterator &lhs, const QCborMap::ConstIterator &rhs) |
| bool | operator==(const QCborMap::Iterator &lhs, const QCborMap::Iterator &rhs) |
| bool | operator>(const QCborMap::Iterator &lhs, const QCborMap::ConstIterator &rhs) |
| bool | operator>(const QCborMap::Iterator &lhs, const QCborMap::Iterator &rhs) |
| bool | operator>=(const QCborMap::Iterator &lhs, const QCborMap::ConstIterator &rhs) |
| bool | operator>=(const QCborMap::Iterator &lhs, const QCborMap::Iterator &rhs) |
Descrizione dettagliata
QCborMap::Iterator consente di iterare su un oggetto di tipo ` QCborMap ` e di modificare il valore (ma non la chiave) memorizzato sotto una determinata chiave. Se si desidera iterare su un `const QCborMap`, è necessario utilizzare ` QCborMap::ConstIterator`. In generale, è buona pratica utilizzare ` QCborMap::ConstIterator ` anche su un `non-const QCborMap `, a meno che non sia necessario modificare l'` QCborMap ` tramite l'iteratore. Gli iteratori `const` sono leggermente più veloci e migliorano la leggibilità del codice.
È necessario inizializzare l’iteratore utilizzando una funzione QCborMap come QCborMap::begin(), QCborMap::end() o QCborMap::find() prima di poter iniziare l’iterazione.
È possibile utilizzare più iteratori sullo stesso oggetto. Tuttavia, gli iteratori esistenti diventeranno "dangling" una volta che l'oggetto verrà modificato.
Vedi anche QCborMap::ConstIterator.
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
[constexpr noexcept default] Iterator::Iterator()
Crea un iteratore non inizializzato.
Funzioni come key(), value() e l'operatore++() non devono essere chiamate su un iteratore non inizializzato. Utilizzare l'operatore=() per assegnargli un valore prima di utilizzarlo.
Vedi anche QCborMap::begin() e QCborMap::end().
[constexpr noexcept default] Iterator::Iterator(const QCborMap::Iterator &other)
Crea un iteratore come copia di other.
[constexpr noexcept default] Iterator::~Iterator()
Elimina l'istanza di Iterator.
QCborValue Iterator::key() const
Restituisce la chiave dell'elemento corrente.
Non esiste un modo diretto per modificare la chiave di un elemento tramite un iteratore, sebbene sia possibile farlo chiamando ` QCborMap::erase()` seguito da ` QCborMap::insert()`.
Vedi anche ` value()`.
QCborValueRef Iterator::value() const
Restituisce un riferimento modificabile al valore dell'elemento corrente.
È possibile modificare il valore di una chiave utilizzando value() sul lato sinistro di un'assegnazione.
Il valore restituito è di tipo QCborValueRef, una classe di supporto per QCborArray e QCborMap. Quando si ottiene un oggetto di tipo QCborValueRef, è possibile utilizzarlo come se fosse un riferimento a un QCborValue. Se gli si assegna un valore, l'assegnazione si applicherà all'elemento contenuto in QCborArray o QCborMap da cui è stato ottenuto il riferimento.
Vedi anche key() e operator*().
QCborMap::Iterator::value_type Iterator::operator*() const
Restituisce una coppia contenente la chiave dell'elemento corrente e un riferimento modificabile al valore dell'elemento corrente.
Il secondo elemento della coppia è di tipo QCborValueRef, una classe di supporto per QCborArray e QCborMap. Quando si ottiene un oggetto di tipo QCborValueRef, è possibile utilizzarlo come se fosse un riferimento a un QCborValue. Se gli si assegna un valore, l'assegnazione verrà applicata all'elemento presente in QCborArray o QCborMap da cui è stato ottenuto il riferimento.
QCborMap::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-().
QCborMap::Iterator &Iterator::operator++()
L'operatore prefissato ++, ++i, fa avanzare l'iteratore all'elemento successivo nella mappa e restituisce tale iteratore.
La chiamata a questa funzione su QCborMap::end() porta a risultati non definiti.
Vedi anche operator--().
QCborMap::Iterator Iterator::operator++(int)
L'operatore postfisso ++, i++, fa avanzare l'iteratore all'elemento successivo nella mappa e restituisce un iteratore all'elemento precedentemente corrente.
Si tratta di una funzione sovraccaricata.
QCborMap::Iterator &Iterator::operator+=(qsizetype j)
Fai avanzare l'iteratore di j elementi. Se j è negativo, l'iteratore va all'indietro. Restituisce un riferimento a questo iteratore.
Vedi anche operator-=() e operator+().
qsizetype Iterator::operator-(QCborMap::Iterator j) const
Restituisce la posizione dell'elemento all'iteratore j rispetto all'elemento presente in questo iteratore. Se l'elemento all'indirizzo j si trova prima di questo punto nel tempo, il valore restituito è negativo.
Vedi anche operator+().
QCborMap::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 procede in avanti.
Vedi anche operator+().
QCborMap::Iterator &Iterator::operator--()
L'operatore prefissato --, --i, imposta l'elemento precedente come corrente e restituisce questo iteratore.
La chiamata a questa funzione su QCborMap::begin() porta a risultati indefiniti.
Vedi anche operator++().
QCborMap::Iterator Iterator::operator--(int)
L'operatore postfisso --, i--, rende l'elemento precedente l'elemento corrente e restituisce un iteratore che punta all'elemento che era precedentemente corrente.
Si tratta di una funzione sovraccaricata.
QCborMap::Iterator &Iterator::operator-=(qsizetype j)
Fa avanzare l'iteratore di j elementi. Se j è negativo, l'iteratore va indietro. Restituisce un riferimento a questo iteratore.
Vedi anche ` operator+=()` e ` operator-()`.
const QCborValueConstRef *Iterator::operator->() const
Restituisce un puntatore a un riferimento modificabile al valore della coppia corrente.
QCborMap::Iterator &Iterator::operator=(const QCborMap::Iterator &other)
Crea una copia dell'iteratore other e restituisce un riferimento a questo iteratore.
Elementi non membri correlati
[noexcept] bool operator!=(const QCborMap::Iterator &lhs, const QCborMap::ConstIterator &rhs)
[noexcept] bool operator!=(const QCborMap::Iterator &lhs, const QCborMap::Iterator &rhs)
Restituisce true se lhs punta a una voce della mappa diversa da quella indicata dall'iteratore rhs; altrimenti restituisce false.
Vedi anche operator==().
[noexcept] bool operator<(const QCborMap::Iterator &lhs, const QCborMap::ConstIterator &rhs)
[noexcept] bool operator<(const QCborMap::Iterator &lhs, const QCborMap::Iterator &rhs)
Restituisce ` true ` se la voce nella mappa indicata dall'iteratore ` lhs ` si trova prima della voce indicata dall'iteratore ` rhs `.
[noexcept] bool operator<=(const QCborMap::Iterator &lhs, const QCborMap::ConstIterator &rhs)
[noexcept] bool operator<=(const QCborMap::Iterator &lhs, const QCborMap::Iterator &rhs)
Restituisce ` true ` se la voce nella mappa indicata dall'iteratore ` lhs ` precede o coincide con quella indicata dall'iteratore ` rhs `.
[noexcept] bool operator==(const QCborMap::Iterator &lhs, const QCborMap::ConstIterator &rhs)
[noexcept] bool operator==(const QCborMap::Iterator &lhs, const QCborMap::Iterator &rhs)
Restituisce ` true ` se ` lhs ` punta alla stessa voce nella mappa dell'iteratore ` rhs `; altrimenti restituisce ` false`.
Vedi anche operator!=().
[noexcept] bool operator>(const QCborMap::Iterator &lhs, const QCborMap::ConstIterator &rhs)
[noexcept] bool operator>(const QCborMap::Iterator &lhs, const QCborMap::Iterator &rhs)
Restituisce ` true ` se la voce nella mappa indicata dall'iteratore ` lhs ` si trova dopo la voce indicata dall'iteratore ` rhs `.
[noexcept] bool operator>=(const QCborMap::Iterator &lhs, const QCborMap::ConstIterator &rhs)
[noexcept] bool operator>=(const QCborMap::Iterator &lhs, const QCborMap::Iterator &rhs)
Restituisce ` true ` se la voce nella mappa indicata dall'iteratore ` lhs ` si trova dopo o è la stessa voce indicata 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.