From e044fc4255aa64ef1dbc3d20ed87ed6e2f61a6bd Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 9 May 2021 19:01:59 -0400 Subject: Code refactoring --- src/jsonable.h | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 src/jsonable.h (limited to 'src/jsonable.h') 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 -#include - -class Jsonable { - public: - virtual nlohmann::json toJson(void) const = 0; - operator nlohmann::json() const {return toJson();} - virtual ~Jsonable() {} -}; - -namespace nlohmann { - template struct adl_serializer> { - static void to_json(json& j, const std::shared_ptr& opt) { - if(opt) { - j = *opt; - } else { - j = nullptr; - } - } - static void from_json(const json& j, std::shared_ptr& opt) { - opt = std::shared_ptr(T::create(j)); - } - }; -} -- cgit v1.2.3