From 36a08e45fc185d1f93b952f960edfadc28fce1c2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 16 Jan 2023 04:43:55 +0100 Subject: compat/format: fix after fmtlib update --- compat/format.hpp | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'compat') diff --git a/compat/format.hpp b/compat/format.hpp index faf776f0..1432d847 100644 --- a/compat/format.hpp +++ b/compat/format.hpp @@ -1,6 +1,22 @@ #pragma once #include #include +#include +#include + +namespace fmt { + +template<> struct formatter { + template static constexpr auto parse(ParseContext& ctx) { return ctx.begin(); } + template auto format(Corrade::Containers::StringView const& s, FormatContext& ctx); +}; + +template<> struct formatter { + template static constexpr auto parse(ParseContext& ctx) { return ctx.begin(); } + template auto format(Corrade::Containers::String const& s, FormatContext& ctx); +}; + +} // namespace fmt #if !FMT_USE_NONTYPE_TEMPLATE_ARGS namespace floormat::detail::fmt { @@ -18,8 +34,6 @@ struct fmt_string final { } // namespace floormat::detail::fmt #endif -namespace floormat { - #if !FMT_USE_NONTYPE_TEMPLATE_ARGS template<::floormat::detail::fmt::fmt_string s> consteval auto operator""_cf() noexcept @@ -30,6 +44,8 @@ consteval auto operator""_cf() noexcept using namespace fmt::literals; #endif +namespace floormat { + template std::size_t snformat(char(&buf)[N], Fmt&& fmt, Xs&&... args) { @@ -42,3 +58,13 @@ std::size_t snformat(char(&buf)[N], Fmt&& fmt, Xs&&... args) } } // namespace floormat + +template +auto fmt::formatter::format(Corrade::Containers::StringView const& s, FormatContext& ctx) { + return fmt::format_to(ctx.out(), "{}"_cf, basic_string_view{s.data(), s.size()}); +} + +template +auto fmt::formatter::format(Corrade::Containers::String const& s, FormatContext& ctx) { + return fmt::format_to(ctx.out(), "{}"_cf, basic_string_view{s.data(), s.size()}); +} -- cgit v1.2.3