From c7caf58e53975ad0f1d2da88708697c7b1bb5c32 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 9 Feb 2024 23:46:45 +0100 Subject: loader, serialize: clean up a bit --- serialize/magnum-vector.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'serialize/magnum-vector.cpp') diff --git a/serialize/magnum-vector.cpp b/serialize/magnum-vector.cpp index 2a31877e..8e9bfaeb 100644 --- a/serialize/magnum-vector.cpp +++ b/serialize/magnum-vector.cpp @@ -1,6 +1,7 @@ #include "magnum-vector.hpp" #include "compat/format.hpp" #include "compat/exception.hpp" +#include "corrade-string.hpp" #include #include #include @@ -10,12 +11,12 @@ namespace floormat::Serialize { namespace { -[[noreturn]] void throw_failed_to_parse_vector2(const std::string& str) +[[noreturn]] void throw_failed_to_parse_vector2(StringView str) { fm_throw("failed to parse Vector2 '{}'"_cf, str); } -[[noreturn]] void throw_vector2_overflow(const std::string& str) +[[noreturn]] void throw_vector2_overflow(StringView str) { fm_throw("numeric overflow in Vector2 '{}'"_cf, str); } @@ -63,7 +64,7 @@ struct vec2_serializer static void from_json(const json& j, Vector<2, T>& val) { using namespace floormat; - std::string str = j; + StringView str = j; using type = std::conditional_t, intmax_t, uintmax_t>; constexpr auto format_string = std::is_signed_v ? "%jd x %jd%n" : "%ju x %ju%n"; type x = 0, y = 0; -- cgit v1.2.3