diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-11-25 22:08:56 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-11-25 22:08:56 +0100 |
commit | 042f183002b88a1af7cf3c634277695dc7b43ac8 (patch) | |
tree | 03033aaa161f9350146efbc113e6e0c90e138306 /compat/debug.hpp | |
parent | 6edd4cb9eaca78a5c4254265f27602e7055d7e44 (diff) |
a
Diffstat (limited to 'compat/debug.hpp')
-rw-r--r-- | compat/debug.hpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/compat/debug.hpp b/compat/debug.hpp index 56db4b0f..4de2e5ea 100644 --- a/compat/debug.hpp +++ b/compat/debug.hpp @@ -15,7 +15,7 @@ concept DebugPrintable = requires(Debug& dbg, const T& value) { namespace floormat::detail::corrade_debug { // ***** colon ***** -struct Colon {}; +struct Colon { char c; }; Debug& operator<<(Debug& dbg, Colon box); // ***** error string ***** @@ -23,15 +23,15 @@ struct ErrorString { int value; }; Debug& operator<<(Debug& dbg, ErrorString box); // ***** quoted ***** -template<typename T> struct Quoted { const T& value; }; +template<typename T> struct Quoted { const T& value; char c; }; Debug::Flags quoted_begin(Debug& dbg, char c); Debug& quoted_end(Debug& dbg, Debug::Flags flags, char c); template<typename T> Debug& operator<<(Debug& dbg, Quoted<T> box) { - Debug::Flags flags = quoted_begin(dbg, '\''); + Debug::Flags flags = quoted_begin(dbg, box.c); dbg << box.value; - return quoted_end(dbg, flags, '\''); + return quoted_end(dbg, flags, box.c); } } // namespace floormat::detail::corrade_debug @@ -42,9 +42,11 @@ template<typename T> Debug& operator<<(Debug& dbg, Quoted<T> box) namespace floormat { -floormat::detail::corrade_debug::Colon colon(); +floormat::detail::corrade_debug::Colon colon(char c = ':'); floormat::detail::corrade_debug::ErrorString error_string(int error); floormat::detail::corrade_debug::ErrorString error_string(); -template<DebugPrintable T> floormat::detail::corrade_debug::Quoted<T> quoted(const T& value) { return { value }; } + +template<DebugPrintable T> floormat::detail::corrade_debug::Quoted<T> quoted(const T& value, char c = '\'') { return { value, c }; } +template<DebugPrintable T> floormat::detail::corrade_debug::Quoted<T> quoted2(const T& value) { return { value, '"' }; } } // namespace floormat |