QJsonArray: use QJsonValueConstRef

Change-Id: I5e52dc5b093c43a3b678fffd16b6086dcd1d3268
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
bb10
Thiago Macieira 2021-11-09 16:39:42 -08:00
parent 51fc317041
commit f5762cd4b3
1 changed files with 8 additions and 7 deletions

View File

@ -126,7 +126,8 @@ public:
}
inline QJsonValueRef operator*() const { return item; }
inline QJsonValueRef *operator->() const { return &item; }
inline const QJsonValueConstRef *operator->() const { return &item; }
inline QJsonValueRef *operator->() { return &item; }
inline QJsonValueRef operator[](qsizetype j) const
{ return { item.a, qsizetype(item.index) + j }; }
@ -161,7 +162,7 @@ public:
inline qsizetype operator-(iterator j) const { return item.index - j.item.index; }
private:
mutable QJsonValueRef item;
QJsonValueRef item;
friend class QJsonArray;
};
friend class iterator;
@ -187,11 +188,11 @@ public:
return *this;
}
inline const QJsonValueRef operator*() const { return item; }
inline const QJsonValueRef *operator->() const { return &item; }
inline const QJsonValueConstRef operator*() const { return item; }
inline const QJsonValueConstRef *operator->() const { return &item; }
inline QJsonValueRef operator[](qsizetype j) const
{ return { item.a, qsizetype(item.index) + j }; }
inline QJsonValueConstRef operator[](qsizetype j) const
{ return QJsonValueRef{ item.a, qsizetype(item.index) + j }; }
inline bool operator==(const const_iterator &o) const
{ return item.a == o.item.a && item.index == o.item.index; }
inline bool operator!=(const const_iterator &o) const { return !(*this == o); }
@ -214,7 +215,7 @@ public:
inline qsizetype operator-(const_iterator j) const { return item.index - j.item.index; }
private:
QJsonValueRef item;
QJsonValueConstRef item;
friend class QJsonArray;
};
friend class const_iterator;