#pragma once #include #include #include namespace floormat { template concept DebugPrintable = requires(Debug& dbg, const T& value) { { dbg << value } -> std::convertible_to; }; } // namespace floormat namespace floormat::detail::corrade_debug { // ***** colon ***** struct Colon { char c; }; Debug& operator<<(Debug& dbg, Colon box); // ***** error string ***** struct ErrorString { int value; }; Debug& operator<<(Debug& dbg, ErrorString box); // ***** quoted ***** template 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 Debug& operator<<(Debug& dbg, Quoted box) { Debug::Flags flags = quoted_begin(dbg, box.c); dbg << box.value; return quoted_end(dbg, flags, box.c); } } // namespace floormat::detail::corrade_debug // ***** api ***** // ***** functions ***** namespace floormat { 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 floormat::detail::corrade_debug::Quoted quoted(const T& value, char c = '\'') { return { value, c }; } template floormat::detail::corrade_debug::Quoted quoted2(const T& value) { return { value, '"' }; } } // namespace floormat