aboutsummaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-05-09 13:56:46 -0400
committerYour Name <you@example.com>2021-05-09 13:56:46 -0400
commitd13358b71ec15085f2638fd9c3fc634df62dfc94 (patch)
tree467c643a068bf2d83da3632823a6434244ae004e /src/utils.h
parente3aaa68a2ea1a403256150121c57a0287014162f (diff)
downloaddmtool-d13358b71ec15085f2638fd9c3fc634df62dfc94.tar.gz
dmtool-d13358b71ec15085f2638fd9c3fc634df62dfc94.tar.bz2
dmtool-d13358b71ec15085f2638fd9c3fc634df62dfc94.zip
Reduced dependency on json-related hacks
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/utils.h b/src/utils.h
index dea052b..71041a7 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -106,7 +106,7 @@ namespace utils {
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) {
+ template<typename T> std::vector<std::shared_ptr<T>> instantiateNames(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);
@@ -114,20 +114,4 @@ namespace utils {
}
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;
- }
}