diff options
Diffstat (limited to 'serialize')
-rw-r--r-- | serialize/ground-atlas.cpp | 6 | ||||
-rw-r--r-- | serialize/wall-atlas.cpp | 38 | ||||
-rw-r--r-- | serialize/wall-atlas.hpp | 6 |
3 files changed, 22 insertions, 28 deletions
diff --git a/serialize/ground-atlas.cpp b/serialize/ground-atlas.cpp index 8703881d..3522e85c 100644 --- a/serialize/ground-atlas.cpp +++ b/serialize/ground-atlas.cpp @@ -1,13 +1,9 @@ #include "ground-atlas.hpp" -#include "src/ground-atlas.hpp" #include "serialize/corrade-string.hpp" #include "serialize/magnum-vector.hpp" -#include "loader/loader.hpp" #include "serialize/pass-mode.hpp" -#include "compat/exception.hpp" +#include "loader/ground-info.hpp" #include <tuple> -#include <Corrade/Containers/Optional.h> -#include <Corrade/Containers/String.h> #include <nlohmann/json.hpp> namespace floormat { diff --git a/serialize/wall-atlas.cpp b/serialize/wall-atlas.cpp index 85de29ec..0ba1c297 100644 --- a/serialize/wall-atlas.cpp +++ b/serialize/wall-atlas.cpp @@ -13,7 +13,25 @@ #include <Magnum/Trade/ImageData.h> #include <nlohmann/json.hpp> -// todo add test on dummy files that generates 100% coverage on the j.contains() blocks! +namespace floormat::Wall { +NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Frame, offset, size) +NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Info, name, depth) +} // namespace floormat::Wall + +namespace nlohmann { + +using floormat::Wall::Frame; + +template<> +struct adl_serializer<floormat::Wall::Frame> { + static void to_json(json& j, const Frame& val); + static void from_json(const json& j, Frame& val); +}; + +void adl_serializer<Frame>::to_json(json& j, const Frame& x) { using nlohmann::to_json; to_json(j, x); } +void adl_serializer<Frame>::from_json(const json& j, Frame& x) { using nlohmann::from_json; from_json(j, x); } + +} // namespace nlohmann namespace floormat { @@ -170,6 +188,8 @@ bool is_direction_defined(const Direction& dir) return false; } +// todo add test on dummy files that generates 100% coverage on the j.contains() blocks! + Group read_group_metadata(const json& jgroup) { fm_assert(jgroup.is_object()); @@ -312,19 +332,3 @@ void write_info_header(json& jroot, const Info& info) } } // namespace floormat::Wall::detail - -namespace floormat::Wall { - -NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Frame, offset, size) -NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Info, name, depth) - -} // namespace floormat::Wall - -namespace nlohmann { - -using floormat::Wall::Frame; - -void adl_serializer<Frame>::to_json(json& j, const Frame& x) { using nlohmann::to_json; to_json(j, x); } -void adl_serializer<Frame>::from_json(const json& j, Frame& x) { using nlohmann::from_json; from_json(j, x); } - -} // namespace nlohmann diff --git a/serialize/wall-atlas.hpp b/serialize/wall-atlas.hpp index febdf583..e7e553ce 100644 --- a/serialize/wall-atlas.hpp +++ b/serialize/wall-atlas.hpp @@ -4,12 +4,6 @@ #include <memory> #include <nlohmann/json_fwd.hpp> -template<> -struct nlohmann::adl_serializer<floormat::Wall::Frame> { - static void to_json(json& j, const floormat::Wall::Frame& val); - static void from_json(const json& j, floormat::Wall::Frame& val); -}; - namespace floormat::Wall::detail { using nlohmann::json; |