From d4da04a7507177f702aee7c5e58daa6788d00fd5 Mon Sep 17 00:00:00 2001 From: Alex Maystrenko Date: Sat, 5 Feb 2022 21:19:55 +0100 Subject: [PATCH] move Glib ustring format helper to utils this formatter is useful for other modules which want to print Glib exceptions messages --- include/util/format.hpp | 11 +++++++++++ src/modules/sni/item.cpp | 8 +------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/include/util/format.hpp b/include/util/format.hpp index 543a100..48f0f51 100644 --- a/include/util/format.hpp +++ b/include/util/format.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include class pow_format { public: @@ -84,5 +85,15 @@ namespace fmt { ); } }; + + + // Glib ustirng support + template <> + struct formatter : formatter { + template + auto format(const Glib::ustring& value, FormatContext& ctx) { + return formatter::format(value, ctx); + } + }; } diff --git a/src/modules/sni/item.cpp b/src/modules/sni/item.cpp index b504c8d..74987ca 100644 --- a/src/modules/sni/item.cpp +++ b/src/modules/sni/item.cpp @@ -8,13 +8,7 @@ #include #include -template <> -struct fmt::formatter : formatter { - template - auto format(const Glib::ustring& value, FormatContext& ctx) { - return formatter::format(value, ctx); - } -}; +#include "util/format.hpp" template <> struct fmt::formatter : formatter {