diff options
author | Your Name <you@example.com> | 2021-05-05 09:44:50 -0400 |
---|---|---|
committer | Your Name <you@example.com> | 2021-05-05 09:44:50 -0400 |
commit | 2a9f262e6db5906db445d465e500d7ba8c90fab3 (patch) | |
tree | 34f850754b0c9114ede9d7b2bb8da90dffddc4fe /src/utils.h | |
parent | 8614137f7f32f2c9f3c11419110cd70dd7f3b505 (diff) | |
download | dmtool-2a9f262e6db5906db445d465e500d7ba8c90fab3.tar.gz dmtool-2a9f262e6db5906db445d465e500d7ba8c90fab3.tar.bz2 dmtool-2a9f262e6db5906db445d465e500d7ba8c90fab3.zip |
Implemented additional commands
Diffstat (limited to 'src/utils.h')
-rw-r--r-- | src/utils.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h index 2a66101..bf789e1 100644 --- a/src/utils.h +++ b/src/utils.h @@ -17,8 +17,14 @@ namespace utils { // looks up directory in settings. Returns element matching name. nlohmann::json loadJson(const std::string& type, const std::string& name); + // goes through the available types and searches for the one matching name. + nlohmann::json findByName(const std::string& name); + void saveJson(const nlohmann::json& data, const std::string& path); + // converts in-place + std::string lower(std::string& in); + template<typename S, typename D> std::shared_ptr<S> loadDFromJson(const nlohmann::json& data) { try { return std::shared_ptr<S>(new D(loadJson(data["type"], data["name"]), data)); |