summaryrefslogtreecommitdiffhomepage
path: root/compat/debug.cpp
blob: e3efaf5c4b077c871d20d487270d043a1a774b08 (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
32
33
34
35
36
37
38
39
40
41
42
43
#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, char c)
{
    auto flags = dbg.flags();
    dbg << "";
    dbg.setFlags(flags | Debug::Flag::NoSpace);
    char buf[2] { c, '\0' };
    dbg << buf;
    return flags;
}

Debug& debug2(Debug& dbg, Debug::Flags flags, char c)
{
    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