summaryrefslogtreecommitdiffstats
path: root/examples/corelib/serialization/convert/jsonconverter.h
Commit message (Collapse)AuthorAgeFilesLines
* Eliminate duplicate overrides of Converter methods in exampleEdward Welbourne2023-11-011-1/+0
| | | | | | | | | | | | | | | | | The Out-only converters shouldn't need to implement loadFile(), as it shouldn't be called - a converter is not used for input unless it says it supports input. At the same time, provide the "ground state" implementations for optionsHelp(), outputOptions() and probeFile() to save the trivial implementations the need to duplicate one another. In the process, make the handling of loadFile()'s outputConverter more consistent among those that do implement it. Always set outputConverter if it's initially null (the caller does assert this). Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I856d12c791d1f8e0accdb7dd1412d493117b2302 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Turn Converter::Direction into a QFlags enumEdward Welbourne2023-09-081-1/+1
| | | | | | | | | This lets us testFlag() instead of using raw bit-field operations. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I2c26e9a24728e81baa42cf14c75271a015460913 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Serialization converter example: const-ify the Converter typeEdward Welbourne2023-09-081-7/+8
| | | | | | | | | | | | Its methods act on their parameters without changing the converter, so can all be const. Its instances thus have no non-const members to exercise, so can always be const. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: Ifcdb2f2159c2cfcd7998dd118aa327a32d299ccf Reviewed-by: Dennis Oberst <dennis.oberst@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* corelib/serialization examples: clang-tidy and coding style clean-upEdward Welbourne2023-09-081-3/+0
| | | | | | | | | | | | I overrode clang-tidy where it uglified or obfuscated and did some clean-up provoked or made possible by its changes. Konrad pointed out, in review, a constructor that could be = default; it could, in fact, vanish entirely as a result. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I9b7744a3abaa29e6f9e0689d0f6985bfd88cd0fd Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-49/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Deprecate QJsonDocument methods for converting to/from JSON binarySona Kurazyan2020-01-091-13/+0
| | | | | | | | | Also remove the example code for deprecated methods and use CBOR instead where it makes sense. Task-number: QTBUG-81068 Change-Id: Iffb7a4b3d7b16a1e485fc05b3ab2e2468e9e0718 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Examples: add an example that converts between different file formatsThiago Macieira2018-07-041-0/+85
This example converts to and from: - Binary JSON - CBOR - CBOR Diagnostic notation (output only) - JSON - Null (output only) - QDataStream - QVariant dump (output only) - Text - XML Change-Id: Ibab69e0efefb40bdbf94fffd150b59f8c0da3174 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>