summaryrefslogtreecommitdiffstats
path: root/src/corelib/serialization/qcbormap.h
Commit message (Collapse)AuthorAgeFilesLines
* Pass non-trivial types by const-ref in range-loop [-Wclazy-range-loop]Sergio Martins2018-12-051-1/+1
| | | | | | | | | | | | | corelib/serialization/qcbormap.h:176:14: warning: Missing reference in range-for with non trivial type (QPair<QCborValue, QCborValue>) corelib/serialization/qjsoncbor.cpp:820:10: warning: Missing reference in range-for with non trivial type (QJsonValue) gui/kernel/qguiapplication.cpp:1171:10: warning: Missing reference in range-for with non trivial type (QString) printsupport/dialogs/qprintdialog_unix.cpp:741:10: warning: Missing reference in range-for with non trivial type (QString) printsupport/kernel/qprinter.cpp:1851:10: warning: Missing reference in range-for with non trivial type (QVariant) tools/qlalr/cppgenerator.cpp:463:8: warning: Missing reference in range-for with non trivial type (Name) Change-Id: I327b0f116e329e55952ed5740a5f5af4b2918392 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fully support operator[] on QCborValue and QCborValueRefEdward Welbourne2018-11-011-1/+4
| | | | | | | | | | | Added operator[] to QCborValueRef and mutating operator[] both there and in QCborValue. If the value (referenced) is not a container, it is replaced with a map and a reference into the result is returned. If the value is an array and the key is a string, negative, or more than 0xffff, the array is first converted to a map. Change-Id: Ibbc9e480fb25eb3d05547c8a1b99e762b2a68b68 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-10-091-4/+12
|\ | | | | | | Change-Id: I5cbfd39cf728036bbdfdeec8e8739568e0a3025b
| * Support QCborMap::operator[] taking a string literalEdward Welbourne2018-10-081-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use a template on the size of the char[], as suggested by Ville Voutilainen. This resolves ambiguity about whether such look-ups should be done via QString or QCborValue (not that it would have made any difference). When we come to add mutating indexing of QCborValue, chained dereferences like map[i][j][k] need to stay in operator[] const throughout, to avoid detaching intermediates to create references into them due to using the mutating operator[] on the earlier dereference's return. So const-qualify the QCborValue operator[] const variants at the same time, to match those of QCborValue itself. Change-Id: Ib1652ae9440fe3767a653afa2856b74040210e07 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Implement QDataStream operator for main CBOR classesJędrzej Nowacki2018-10-031-0/+7
|/ | | | | | Change-Id: Ib3b68b1963625432c68d02be3bf2ec3c4baf1104 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* CBOR: Add missing clear() methods to the two container classesThiago Macieira2018-09-091-0/+1
| | | | | | Change-Id: Id59bdd8f1a804b809e22fffd153fd5174b58014d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* JSON: Add qHash functions for JSON and CBOR typesUlf Hermann2018-08-271-0/+2
| | | | | | | This way we can easily use them as keys in QHash and QSet. Change-Id: Ie744c3b5ad1176ba2ab035c7e650af483757a0c9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCborValue: Disable support for spaceship operatorThiago Macieira2018-07-291-1/+1
| | | | | | | | | __has_include(<compare>) is not the correct way to detect this feature, since that's a library header and may be provided by an implementation (libc++) before the compiler supports the syntax. Change-Id: I80aae0d068974d83b6c0fffd1544c8e558e2446b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QCborMap: make take() & remove() efficient if the item isn't thereThiago Macieira2018-07-141-8/+8
| | | | | | | | | By using constFind(), we won't detach if the item isn't there. Both extract() and erase() can take const_iterators. Change-Id: Id59bdd8f1a804b809e22fffd153f92989ef84644 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CBOR: Use "noexcept" directlyThiago Macieira2018-07-141-9/+9
| | | | | | | | | | | All supported compilers support it. Doing this just for the new API. We should do it throughout Qt, but only if it won't interfere with the header review. Change-Id: Id59bdd8f1a804b809e22fffd153f9254688e5152 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QCborValue: implement move semantics for QCbor{Array,Map} constructorsThiago Macieira2018-07-041-0/+5
| | | | | | | | Happens a lot because of the implicit conversions. So I made it inline. Change-Id: Icc2c231dc2c44abdb087fffd1533f311b95460b8 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCborArray & Map: implement efficient take() / extract()Thiago Macieira2018-07-041-0/+10
| | | | | | | | | | | | Questions: 1) should QCborMap::extract return value_type (a pair) instead of just the value? 2) should the both return the iterator to the next element too, like erase()? Change-Id: I052407b777ec43f78378fffd15302a9c14468db3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CBOR: Add QDebug operators for the Qt CBOR value-like typesThiago Macieira2018-07-041-0/+4
| | | | | | | | | | I added a function that returns the string identifiers for QCborKnownTags and QCborSimpleType, in order to facilitate writing a QTest::toString for those types, as neither enum is part of a Q_OBJECT or Q_GADGET class. Change-Id: I56b444f9d6274221a3b7fffd150d2d26a1925c19 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QCborValue: fix warning about shadowing membersThiago Macieira2018-06-181-8/+8
| | | | | | | | | | | qcborvalue.h:145:9: error: declaration of 'taggedValue' shadows a member of 'this' [-Werror=shadow] Newer versions of GCC don't warn for variable shadowing a member function. Task-number: QTBUG-68889 Change-Id: I6efb28c3145047559ec0fffd153857b856267d6d Reviewed-by: Liang Qi <liang.qi@qt.io>
* QCborValue: add support for QVariant and JSON conversionsThiago Macieira2018-06-081-0/+7
| | | | | | | Plus QStringList. Change-Id: I39332e0a867442d58082fffd1508dfb9b540af23 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Long live DOM API for CBOR!Thiago Macieira2018-06-081-0/+320
This is very similar to QJsonDocument, but there's no QCborDocument. QCborValue is that. [ChangeLog][QtCore] Added QCborValue, QCborArray and QCborMap, classes that permit DOM-like access to CBOR data. The API is similar to QJsonValue, QJsonArray and QJsonObject, respectively. Change-Id: I9741f017961b410c910dfffd14ffca50dd8ef3ba Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>