diff options
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)); |