diff options
Diffstat (limited to 'serialize/json-helper.hpp')
-rw-r--r-- | serialize/json-helper.hpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/serialize/json-helper.hpp b/serialize/json-helper.hpp index e0e2c0ca..90ce2e9a 100644 --- a/serialize/json-helper.hpp +++ b/serialize/json-helper.hpp @@ -1,20 +1,19 @@ #pragma once #include <nlohmann/json.hpp> -#include <filesystem> +#include <Corrade/Containers/StringView.h> namespace floormat { struct json_helper final { using json = nlohmann::json; - using fspath = std::filesystem::path; - template<typename T> static T from_json(const fspath& pathname); - template<typename T> static void to_json(const T& self, const fspath& pathname, int indent = 1); - static json from_json_(const fspath& pathname); - static void to_json_(const json& j, const fspath& pathname, int indent); + template<typename T> static T from_json(StringView pathname); + template<typename T> static void to_json(const T& self, StringView pathname, int indent = 1); + static json from_json_(StringView pathname); + static void to_json_(const json& j, StringView pathname, int indent); }; -template<typename T> T json_helper::from_json(const fspath& pathname) { return from_json_(pathname); } -template<typename T> void json_helper::to_json(const T& self, const fspath& pathname, int indent) { to_json_(json(self), pathname, indent); } +template<typename T> T json_helper::from_json(StringView pathname) { return from_json_(pathname); } +template<typename T> void json_helper::to_json(const T& self, StringView pathname, int indent) { to_json_(json(self), pathname, indent); } } // namespace floormat |