summaryrefslogtreecommitdiffstats
path: root/src/corelib/serialization/qcborvalue_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Change QCborArray to pad with invalid on inserting past endEdward Welbourne2018-10-081-0/+1
| | | | | | | | | Likewise have mutating operator[] insert an invalid entry at its target index, if beyond the end of the array. This makes it possible to fill an array from high index to low, for example. Change-Id: If71699c20e2623142214ce2c11c4d6e4a120c989 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCborValue: move the toDiagnosticNotation() function to its own fileThiago Macieira2018-07-301-0/+2
| | | | | | | | | | If we ever need to add QCborValue to the bootstrap library, it's unlikely that we'll need this part. And by splitting it, I can make the code handle more cases, that hadn't been properly handled before. Change-Id: I2f630efbbce54f14bfa9fffd154160c0ad893695 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QCborValue: Silence Coverity warning about null-pointer dereferenceThiago Macieira2018-07-141-2/+2
| | | | | | | | | | | | It's a false positive, since we've checked that the item HasByteData. But it's cheap to rewrite so the warning is silenced. >>> CID 190741: Null pointer dereferences (NULL_RETURNS) >>> Dereferencing a null pointer "this->byteData(idx)". Change-Id: If48c5c2e920c433298f1fffd153f7534be42a30b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QCborArray & Map: implement move semanticsThiago Macieira2018-07-051-7/+12
| | | | | | | | | | | There isn't a lot of efficiency gain, since QCborValue was already refcounted. This saves two atomic operations and an out-of-line call. In the case of QCborValueRef (which includes QCborMap), because we reset the container pointer in inline code, the call to QCborValue::dispose() is also suppressed. Change-Id: Icc2c231dc2c44abdb087fffd1533eaba7a9c70fa Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QCborArray & Map: implement efficient take() / extract()Thiago Macieira2018-07-041-2/+23
| | | | | | | | | | | | 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>
* QCborValue: store US-ASCII strings as 8-bitThiago Macieira2018-06-181-3/+8
| | | | | | | | | | | | They're easy to convert back to UTF-16, their length is the same, they occupy half the memory and they're easy to encode into CBOR (no transformation necessary). The code was copied from QJsonPrivate::Latin1String::operator=(). Change-Id: I56b444f9d6274221a3b7fffd150c52bcb6c97f37 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCborValue: add support for QVariant and JSON conversionsThiago Macieira2018-06-081-2/+1
| | | | | | | Plus QStringList. Change-Id: I39332e0a867442d58082fffd1508dfb9b540af23 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Long live DOM API for CBOR!Thiago Macieira2018-06-081-0/+366
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>