aboutsummaryrefslogtreecommitdiff
path: root/src/jsonable.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/jsonable.h')
-rw-r--r--src/jsonable.h26
1 files changed, 0 insertions, 26 deletions
diff --git a/src/jsonable.h b/src/jsonable.h
deleted file mode 100644
index 01c720b..0000000
--- a/src/jsonable.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#pragma once
-#include "json.hpp"
-#include <memory>
-#include <vector>
-
-class Jsonable {
- public:
- virtual nlohmann::json toJson(void) const = 0;
- operator nlohmann::json() const {return toJson();}
- virtual ~Jsonable() {}
-};
-
-namespace nlohmann {
- template <typename T> struct adl_serializer<std::shared_ptr<T>> {
- static void to_json(json& j, const std::shared_ptr<T>& opt) {
- if(opt) {
- j = *opt;
- } else {
- j = nullptr;
- }
- }
- static void from_json(const json& j, std::shared_ptr<T>& opt) {
- opt = std::shared_ptr<T>(T::create(j));
- }
- };
-}