QCborArray: use QCborValueConstRef
Change-Id: I5e52dc5b093c43a3b678fffd16b6077e5c4abd63 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
This commit is contained in:
parent
04dc959d49
commit
64d568b550
@ -233,7 +233,7 @@ inline void QFactoryLoaderPrivate::updateSinglePath(const QString &path)
|
||||
metaDataOk = true;
|
||||
|
||||
const QCborArray k = object.value(QLatin1String("Keys")).toArray();
|
||||
for (QCborValueRef v : k)
|
||||
for (QCborValueConstRef v : k)
|
||||
keys += cs ? v.toString() : v.toString().toLower();
|
||||
}
|
||||
qCDebug(lcFactoryLoader) << "Got keys from plugin meta data" << keys;
|
||||
@ -435,7 +435,7 @@ QMultiMap<int, QString> QFactoryLoader::keyMap() const
|
||||
for (int i = 0; i < metaDataList.size(); ++i) {
|
||||
const QCborMap metaData = metaDataList.at(i).value(QtPluginMetaDataKeys::MetaData).toMap();
|
||||
const QCborArray keys = metaData.value(QLatin1String("Keys")).toArray();
|
||||
for (QCborValueRef key : keys)
|
||||
for (QCborValueConstRef key : keys)
|
||||
result.insert(i, key.toString());
|
||||
}
|
||||
return result;
|
||||
@ -447,7 +447,7 @@ int QFactoryLoader::indexOf(const QString &needle) const
|
||||
for (int i = 0; i < metaDataList.size(); ++i) {
|
||||
const QCborMap metaData = metaDataList.at(i).value(QtPluginMetaDataKeys::MetaData).toMap();
|
||||
const QCborArray keys = metaData.value(QLatin1String("Keys")).toArray();
|
||||
for (QCborValueRef key : keys) {
|
||||
for (QCborValueConstRef key : keys) {
|
||||
if (key.toString().compare(needle, Qt::CaseInsensitive) == 0)
|
||||
return i;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class Q_CORE_EXPORT QCborArray
|
||||
public:
|
||||
class ConstIterator;
|
||||
class Iterator {
|
||||
mutable QCborValueRef item;
|
||||
QCborValueRef item {};
|
||||
friend class ConstIterator;
|
||||
friend class QCborArray;
|
||||
Iterator(QCborContainerPrivate *dd, qsizetype ii) : item(dd, ii) {}
|
||||
@ -79,7 +79,8 @@ public:
|
||||
}
|
||||
|
||||
QCborValueRef operator*() const { return item; }
|
||||
QCborValueRef *operator->() const { return &item; }
|
||||
QCborValueRef *operator->() { return &item; }
|
||||
const QCborValueConstRef *operator->() const { return &item; }
|
||||
QCborValueRef operator[](qsizetype j) const { return { item.d, item.i + j }; }
|
||||
|
||||
bool operator==(const Iterator &o) const { return item.d == o.item.d && item.i == o.item.i; }
|
||||
@ -106,7 +107,7 @@ public:
|
||||
};
|
||||
|
||||
class ConstIterator {
|
||||
QCborValueRef item;
|
||||
QCborValueConstRef item;
|
||||
friend class Iterator;
|
||||
friend class QCborArray;
|
||||
ConstIterator(QCborContainerPrivate *dd, qsizetype ii) : item(dd, ii) {}
|
||||
@ -127,9 +128,9 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
const QCborValueRef operator*() const { return item; }
|
||||
const QCborValueRef *operator->() const { return &item; }
|
||||
QCborValueRef operator[](qsizetype j) const { return QCborValueRef{ item.d, item.i + j }; }
|
||||
QCborValueConstRef operator*() const { return item; }
|
||||
const QCborValueConstRef *operator->() const { return &item; }
|
||||
QCborValueConstRef operator[](qsizetype j) const { return QCborValueRef{ item.d, item.i + j }; }
|
||||
|
||||
bool operator==(const Iterator &o) const { return item.d == o.item.d && item.i == o.item.i; }
|
||||
bool operator!=(const Iterator &o) const { return !(*this == o); }
|
||||
|
@ -326,7 +326,7 @@ struct QCborValueFormatter
|
||||
{
|
||||
QByteArray out(1, '[');
|
||||
const char *comma = "";
|
||||
for (const QCborValueRef v : a) {
|
||||
for (QCborValueConstRef v : a) {
|
||||
QScopedArrayPointer<char> s(format(v));
|
||||
out += comma;
|
||||
out += s.get();
|
||||
|
Loading…
Reference in New Issue
Block a user