#include "json-helper.hpp" #include #include namespace floormat { template static T open_stream(const std::remove_cvref_t

& filename) { T s; s.exceptions(s.exceptions() | std::ios::failbit | std::ios::badbit); s.open(filename, open_mode); return s; } auto json_helper::from_json_(const fspath& pathname) -> json { json j; open_stream(pathname) >> j; return j; } void json_helper::to_json_(const json& j, const fspath& pathname, int indent) { (open_stream(pathname) << j.dump(indent, '\t') << '\n').flush(); } } // namespace floormat