Wizard
Software Engineering Project - Wizard
Loading...
Searching...
No Matches
serializable.h
1//
2// Created by Manuel on 01.02.2021.
3//
4// abstract class for a serializable object.
5
6#ifndef WIZARD_SERIALIZABLE_H
7#define WIZARD_SERIALIZABLE_H
8
9#include "../../rapidjson/include/rapidjson/document.h"
10
12public:
13 virtual ~serializable() = default;
14
15 virtual rapidjson::Document* to_json() const {
16 rapidjson::Document* json = new rapidjson::Document();
17 json->SetObject();
18 this->write_into_json(*json, json->GetAllocator());
19 return json;
20 }
21
22 virtual void write_into_json(rapidjson::Value& json, rapidjson::Document::AllocatorType& allocator) const = 0;
23};
24
25#endif //WIZARD_SERIALIZABLE_H
Definition serializable.h:11