aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/dbg_output/engine.cpp
blob: 2057b414366de8b5aa5e029cffe169f6aa256500 (plain) (blame)
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
#include "engine.h"

#include <util/string/cast.h>
#include <util/string/escape.h>

#if !defined(DBGDUMP_INLINE_IF_INCLUDED)
#define DBGDUMP_INLINE_IF_INCLUDED
#endif

DBGDUMP_INLINE_IF_INCLUDED void TDumpBase::String(const TStringBuf& s) {
    if (s) {
        Raw(TString(s).Quote()); 
    } else {
        Raw("(empty)");
    }
}

DBGDUMP_INLINE_IF_INCLUDED void TDumpBase::String(const TWtringBuf& s) {
    Raw("w");
    String(ToString(s));
}

DBGDUMP_INLINE_IF_INCLUDED void TDumpBase::Raw(const TStringBuf& s) {
    Stream().Write(s.data(), s.size());
}

DBGDUMP_INLINE_IF_INCLUDED void TDumpBase::Char(char ch) {
    Raw("'" + EscapeC(&ch, 1) + "'");
}

DBGDUMP_INLINE_IF_INCLUDED void TDumpBase::Char(wchar16 ch) {
    Raw("w'" + ToString(EscapeC(&ch, 1)) + "'");
}