summaryrefslogtreecommitdiffhomepage
path: root/compat/debug.hpp
blob: 0009ce52bc268947c255cfee6c3b72c09bfbee7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once
#include <Corrade/Utility/Debug.h>
#include <Corrade/Utility/Move.h>
#include <Corrade/Containers/Containers.h>

namespace floormat::detail::corrade_debug {

struct ErrorString final { int value; };
Debug& operator<<(Debug& dbg, ErrorString box);

template<typename T> struct Quoted final { const T& value; };
Debug::Flags debug1(Debug& dbg, char c);
Debug& debug2(Debug& dbg, Debug::Flags flags, char c);

template<typename T> Debug& operator<<(Debug& dbg, Quoted<T> box)
{
    Debug::Flags flags = debug1(dbg, '\'');
    dbg << box.value;
    return debug2(dbg, flags, '\'');
}

extern template struct Quoted<StringView>;

} // namespace floormat::detail::corrade_debug

namespace floormat {

floormat::detail::corrade_debug::ErrorString error_string(int error);
template<typename T> floormat::detail::corrade_debug::Quoted<T> quoted(const T& value) { return { value }; }

} // namespace floormat