From 2a9f262e6db5906db445d465e500d7ba8c90fab3 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 5 May 2021 09:44:50 -0400 Subject: Implemented additional commands --- src/jsonable.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/jsonable.h') diff --git a/src/jsonable.h b/src/jsonable.h index 2c0da6b..0385fb1 100644 --- a/src/jsonable.h +++ b/src/jsonable.h @@ -16,11 +16,11 @@ template std::vector json2vec(const nlohmann::json& data) { return std::vector(begin(data), end(data)); } -template std::vector jsonList2vec(const std::string& type, const std::vector& names) { - std::vector ret; +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(T(j, j)); + ret.push_back(std::shared_ptr(new T(j, j))); } return ret; } @@ -32,3 +32,11 @@ template std::vector> json2ptrvec(const nlohmann: } 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