diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-11-25 19:31:46 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-11-25 19:31:46 +0100 |
commit | 7409d8ddd39944c4e68ebd50c732ee9a9a886583 (patch) | |
tree | 81d0c3beb6b1c336db19016eeaf2ec648cd21100 /compat/debug.cpp | |
parent | 8f3c494e3d89cd146f4e032ae94ce5456328c87e (diff) |
a
Diffstat (limited to 'compat/debug.cpp')
-rw-r--r-- | compat/debug.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/compat/debug.cpp b/compat/debug.cpp index 0a342f8b..e3efaf5c 100644 --- a/compat/debug.cpp +++ b/compat/debug.cpp @@ -1,24 +1,43 @@ -#define FM_NO_CORRADE_DEBUG_EXTERN_TEMPLATE_QUOTED #include "debug.hpp" +#include "compat/strerror.hpp" namespace floormat::detail::corrade_debug { +Debug& operator<<(Debug& dbg, ErrorString box) +{ + auto flags = dbg.flags(); + char buf[256]; + dbg.setFlags(flags | Debug::Flag::NoSpace); + dbg << ": "; + dbg << get_error_string(buf, box.value); + dbg.setFlags(flags); + return dbg; +} + template struct Quoted<StringView>; -Debug::Flags debug1(Debug& dbg) +Debug::Flags debug1(Debug& dbg, char c) { auto flags = dbg.flags(); dbg << ""; dbg.setFlags(flags | Debug::Flag::NoSpace); - dbg << "'"; + char buf[2] { c, '\0' }; + dbg << buf; return flags; } -Debug& debug2(Debug& dbg, Debug::Flags flags) +Debug& debug2(Debug& dbg, Debug::Flags flags, char c) { - dbg << "'"; + char buf[2] { c, '\0' }; + dbg << buf; dbg.setFlags(flags); return dbg; } } // namespace floormat::detail::corrade_debug + +namespace floormat { + +floormat::detail::corrade_debug::ErrorString error_string(int error) { return { error }; } + +} // namespace floormat |