forked from chronoxor/FastBinaryEncoding
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerator.inl
More file actions
73 lines (60 loc) · 1.28 KB
/
generator.inl
File metadata and controls
73 lines (60 loc) · 1.28 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*!
\file generator.inl
\brief Fast binary encoding generator inline implementation
\author Ivan Shynkarenka
\date 20.04.2018
\copyright MIT License
*/
namespace FBE {
inline Generator::Generator(const std::string& input, const std::string& output, int indent, char space)
: _input(input),
_output(output),
_indent(indent),
_space(space)
{
}
inline void Generator::Indent(int count)
{
_cursor += _indent * count;
}
inline void Generator::WriteBegin()
{
_buffer.clear();
}
inline void Generator::Write(const std::string& str)
{
_buffer.append(str);
}
inline void Generator::WriteIndent()
{
for (int i = 0; i < _cursor; ++i)
_buffer.append(1, _space);
}
inline void Generator::WriteIndent(const std::string& str)
{
for (int i = 0; i < _cursor; ++i)
_buffer.append(1, _space);
_buffer.append(str);
}
inline void Generator::WriteLine()
{
Write(EndLine());
}
inline void Generator::WriteLine(const std::string& str)
{
Write(str);
Write(EndLine());
}
inline void Generator::WriteLineIndent(const std::string& str)
{
WriteIndent(str);
Write(EndLine());
}
inline void Generator::WriteEnd()
{
}
inline std::string Generator::EndLine()
{
return CppCommon::Environment::EndLine();
}
} // namespace FBE