aboutsummaryrefslogtreecommitdiff
path: root/src/jsonable.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/jsonable.h')
-rw-r--r--src/jsonable.h33
1 files changed, 0 insertions, 33 deletions
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 <memory>
-#include <vector>
class Jsonable {
public:
@@ -10,33 +7,3 @@ class Jsonable {
operator nlohmann::json() const {return toJson();}
virtual ~Jsonable() {}
};
-
-template<typename T> std::vector<T> json2vec(const nlohmann::json& data) {
- using std::begin; using std::end;
- return std::vector<T>(begin(data), end(data));
-}
-
-template<typename T> std::vector<std::shared_ptr<T>> jsonList2ptrvec(const std::string& type, const std::vector<std::string>& names) {
- std::vector<std::shared_ptr<T>> ret;
- for(auto name : names) {
- auto j = utils::loadJson(type, name);
- ret.push_back(std::shared_ptr<T>(new T(j, j)));
- }
- return ret;
-}
-
-template<typename T> std::vector<std::shared_ptr<T>> json2ptrvec(const nlohmann::json& data) {
- std::vector<std::shared_ptr<T>> ret;
- for(nlohmann::json d : data) {
- ret.push_back(T::create(d));
- }
- return ret;
-}
-
-template<typename T> std::vector<nlohmann::json> ptrvec2json(std::vector<T> src) {
- std::vector<nlohmann::json> ret;
- for(T i : src) {
- ret.push_back(i->toJson());
- }
- return ret;
-}