File indexing completed on 2025-02-02 05:02:30
0001 /* 0002 SPDX-FileCopyrightText: 2023 Volker Krause <vkrause@kde.org> 0003 SPDX-License-Identifier: LGPL-2.0-or-later 0004 */ 0005 0006 #ifndef JSONIO_H 0007 #define JSONIO_H 0008 0009 class QByteArray; 0010 class QJsonValue; 0011 0012 /** JSON value to/from (binary) representation conversion for persistent storage. */ 0013 namespace JsonIO 0014 { 0015 /** Read JSON value from textual JSON or CBOR binary. */ 0016 QJsonValue read(const QByteArray &data); 0017 0018 enum OutputFormat { 0019 CBOR, 0020 JSON 0021 }; 0022 0023 /** Write JSON value to JSON or CBOR. */ 0024 QByteArray write(const QJsonValue &value, OutputFormat format = CBOR); 0025 0026 /** Convert binary data to the requested output format. */ 0027 QByteArray convert(const QByteArray &data, OutputFormat format); 0028 } 0029 0030 #endif // JSONIO_H