KanoopCommonQt 2.1.1
Kanoop foundational Qt utility library
Loading...
Searching...
No Matches
ideserializablefromjson.h
1/**
2 * @brief Interfaces for deserializing objects from JSON.
3 */
4#ifndef IDESERIALIZABLEFROMJSON_H
5#define IDESERIALIZABLEFROMJSON_H
6
7#include <QJsonArray>
8#include <QJsonObject>
9
10/**
11 * @brief Interface for objects that can deserialize themselves from a raw JSON byte array.
12 */
14{
15public:
16 /**
17 * @brief Populate this object from a JSON byte array.
18 * @param json Raw JSON data
19 */
20 virtual void deserializeFromJson(const QByteArray& json) = 0;
21};
22
23/**
24 * @brief Interface for objects that can deserialize themselves from a QJsonObject.
25 */
27{
28public:
29 /**
30 * @brief Populate this object from a QJsonObject.
31 * @param jsonObject Parsed JSON object containing the data
32 */
33 virtual void deserializeFromJsonObject(const QJsonObject& jsonObject) = 0;
34};
35
36/**
37 * @brief Interface for objects that can deserialize themselves from a QJsonArray.
38 */
40{
41public:
42 /**
43 * @brief Populate this object from a QJsonArray.
44 * @param jsonArray Parsed JSON array containing the data
45 */
46 virtual void deserializeFromJsonArray(const QJsonArray& jsonArray) = 0;
47};
48
49#endif // IDESERIALIZABLEFROMJSON_H
Interface for objects that can deserialize themselves from a QJsonArray.
virtual void deserializeFromJsonArray(const QJsonArray &jsonArray)=0
Populate this object from a QJsonArray.
Interface for objects that can deserialize themselves from a QJsonObject.
virtual void deserializeFromJsonObject(const QJsonObject &jsonObject)=0
Populate this object from a QJsonObject.
Interfaces for deserializing objects from JSON.
virtual void deserializeFromJson(const QByteArray &json)=0
Populate this object from a JSON byte array.