diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-26 18:46:21 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-26 20:06:25 +0100 |
commit | bde5939b2f1eb5c04c1ab429a79fa799c3bfee28 (patch) | |
tree | b1c49902c88746d9b2facaf20f4f52d9197c6dd9 /compat/debug.hpp | |
parent | 8a380af2b8f28400f29a5468a3a1a5629a665867 (diff) |
implement printing fractions for corrade's Debug{}
Diffstat (limited to 'compat/debug.hpp')
-rw-r--r-- | compat/debug.hpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compat/debug.hpp b/compat/debug.hpp index cb36e612..1fdd9a7e 100644 --- a/compat/debug.hpp +++ b/compat/debug.hpp @@ -40,6 +40,16 @@ template<typename T> Debug& operator<<(Debug& dbg, Quoted<T> box) return quoted_end(dbg, flags, box.c); } +// ***** float ***** + +struct Fraction +{ + float value; + uint8_t decimal_points; +}; + +Debug& operator<<(Debug& dbg, Fraction frac); + } // namespace floormat::detail::corrade_debug // ***** api ***** @@ -52,6 +62,8 @@ floormat::detail::corrade_debug::Colon colon(char c = ':'); floormat::detail::corrade_debug::ErrorString error_string(int error); floormat::detail::corrade_debug::ErrorString error_string(); +floormat::detail::corrade_debug::Fraction fraction(float value, uint8_t decimal_points = 1); + template<DebugPrintable T> auto quoted(T&& value, char c = '\'') { |