From 9f3802690f9dd9452e96d1d7a879291978d66e35 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 6 May 2021 14:13:28 -0400 Subject: Refactoring --- src/jsonable.h | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'src/jsonable.h') diff --git a/src/jsonable.h b/src/jsonable.h index 0385fb1..7411efa 100644 --- a/src/jsonable.h +++ b/src/jsonable.h @@ -1,8 +1,5 @@ #pragma once #include "json.hpp" -#include "utils.h" -#include -#include class Jsonable { public: @@ -10,33 +7,3 @@ class Jsonable { operator nlohmann::json() const {return toJson();} virtual ~Jsonable() {} }; - -template std::vector json2vec(const nlohmann::json& data) { - using std::begin; using std::end; - return std::vector(begin(data), end(data)); -} - -template std::vector> jsonList2ptrvec(const std::string& type, const std::vector& names) { - std::vector> ret; - for(auto name : names) { - auto j = utils::loadJson(type, name); - ret.push_back(std::shared_ptr(new T(j, j))); - } - return ret; -} - -template std::vector> json2ptrvec(const nlohmann::json& data) { - std::vector> ret; - for(nlohmann::json d : data) { - ret.push_back(T::create(d)); - } - return ret; -} - -template std::vector ptrvec2json(std::vector src) { - std::vector ret; - for(T i : src) { - ret.push_back(i->toJson()); - } - return ret; -} -- cgit v1.2.3