diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-10-09 01:00:47 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-10-09 01:00:48 +0200 |
commit | 69b6845edbb43cf7000942d07f3a326383bdf6d2 (patch) | |
tree | 58755c33dfb18a51d194d0f774b1deca6135ce4a /src/corelib/serialization/qcbormap.h | |
parent | e2ab24d36f31395c2239b49ac26f2266b69444bd (diff) | |
parent | 8e5a2f63c3f6ee49d3f2e1985bf73de7769b0e72 (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I5cbfd39cf728036bbdfdeec8e8739568e0a3025b
Diffstat (limited to 'src/corelib/serialization/qcbormap.h')
-rw-r--r-- | src/corelib/serialization/qcbormap.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/corelib/serialization/qcbormap.h b/src/corelib/serialization/qcbormap.h index 866b7cd743..0eb163a0a8 100644 --- a/src/corelib/serialization/qcbormap.h +++ b/src/corelib/serialization/qcbormap.h @@ -196,14 +196,22 @@ public: { const_iterator it = find(key); return it == end() ? QCborValue() : it.value(); } QCborValue value(const QCborValue &key) const { const_iterator it = find(key); return it == end() ? QCborValue() : it.value(); } - QCborValue operator[](qint64 key) const +#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + template<size_t N> QT_ASCII_CAST_WARN const QCborValue value(const char (&key)[N]) const + { return value(QString::fromUtf8(key, N - 1)); } +#endif + const QCborValue operator[](qint64 key) const { const_iterator it = find(key); return it == end() ? QCborValue() : it.value(); } - QCborValue operator[](QLatin1String key) const + const QCborValue operator[](QLatin1String key) const { const_iterator it = find(key); return it == end() ? QCborValue() : it.value(); } - QCborValue operator[](const QString & key) const + const QCborValue operator[](const QString & key) const { const_iterator it = find(key); return it == end() ? QCborValue() : it.value(); } - QCborValue operator[](const QCborValue &key) const + const QCborValue operator[](const QCborValue &key) const { const_iterator it = find(key); return it == end() ? QCborValue() : it.value(); } +#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + template<size_t N> QT_ASCII_CAST_WARN const QCborValue operator[](const char (&key)[N]) const + { return operator[](QString::fromUtf8(key, N - 1)); } +#endif QCborValueRef operator[](qint64 key); QCborValueRef operator[](QLatin1String key); QCborValueRef operator[](const QString & key); |