diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2023-11-25 18:59:10 +0100 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-11-25 18:59:10 +0100 |
| commit | 8f3c494e3d89cd146f4e032ae94ce5456328c87e (patch) | |
| tree | 3e77085eb998042b0f538c73ab23eef7211956fd /compat | |
| parent | 9c00238b51442d29d33c0070c2f0f98109479553 (diff) | |
a
Diffstat (limited to 'compat')
| -rw-r--r-- | compat/debug.cpp | 24 | ||||
| -rw-r--r-- | compat/debug.hpp | 26 |
2 files changed, 50 insertions, 0 deletions
diff --git a/compat/debug.cpp b/compat/debug.cpp new file mode 100644 index 00000000..0a342f8b --- /dev/null +++ b/compat/debug.cpp @@ -0,0 +1,24 @@ +#define FM_NO_CORRADE_DEBUG_EXTERN_TEMPLATE_QUOTED +#include "debug.hpp" + +namespace floormat::detail::corrade_debug { + +template struct Quoted<StringView>; + +Debug::Flags debug1(Debug& dbg) +{ + auto flags = dbg.flags(); + dbg << ""; + dbg.setFlags(flags | Debug::Flag::NoSpace); + dbg << "'"; + return flags; +} + +Debug& debug2(Debug& dbg, Debug::Flags flags) +{ + dbg << "'"; + dbg.setFlags(flags); + return dbg; +} + +} // namespace floormat::detail::corrade_debug diff --git a/compat/debug.hpp b/compat/debug.hpp new file mode 100644 index 00000000..1d8e4676 --- /dev/null +++ b/compat/debug.hpp @@ -0,0 +1,26 @@ +#pragma once +#include <Corrade/Utility/Debug.h> +#include <Corrade/Utility/Move.h> + +namespace floormat::detail::corrade_debug { + +template<typename T> struct Quoted final { const T& value; }; + +#ifndef FM_NO_CORRADE_DEBUG_EXTERN_TEMPLATE_QUOTED +extern template struct Quoted<StringView>; +#endif + +Debug::Flags debug1(Debug& dbg); +Debug& debug2(Debug& dbg, Debug::Flags flags); + +template<typename T> +Debug& operator<<(Debug& dbg, detail::corrade_debug::Quoted<T> box) +{ + Debug::Flags flags = detail::corrade_debug::debug1(dbg); + dbg << box.value; + return debug2(dbg, flags); +} + +} // namespace floormat::detail::corrade_debug + +template<typename T> floormat::detail::corrade_debug::Quoted<T> quoted(const T& value) { return { value }; } |
