MCPcopy Create free account
hub / github.com/carbonengine/trinity / YamlOutput

Class YamlOutput

shadercompiler/YamlOutput.h:8–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6
7
8class YamlOutput
9{
10public:
11 explicit YamlOutput( bool enabled = true ) :
12 m_expected( ROOT ),
13 m_enabled( enabled )
14 {
15 }
16
17 bool enabled() const
18 {
19 return m_enabled;
20 }
21
22 YamlOutput& dict()
23 {
24 if( !m_enabled )
25 {
26 return *this;
27 }
28 switch( m_expected )
29 {
30 case VALUE:
31 m_os << std::endl;
32 break;
33 case ELEMENT:
34 indent() << "-" << std::endl;
35 break;
36 default:
37 break;
38 }
39 m_modeStack.push_back( DICT );
40 m_indent = std::string( m_modeStack.size() * 2, ' ' );
41 m_expected = KEY;
42 return *this;
43 }
44 YamlOutput& list()
45 {
46 if( !m_enabled )
47 {
48 return *this;
49 }
50 switch( m_expected )
51 {
52 case VALUE:
53 m_os << std::endl;
54 break;
55 case ELEMENT:
56 indent() << "-" << std::endl;
57 break;
58 default:
59 break;
60 }
61 m_modeStack.push_back( LIST );
62 m_indent = std::string( m_modeStack.size() * 2, ' ' );
63 m_expected = ELEMENT;
64 return *this;
65 }

Callers

nothing calls this directly

Calls 3

sizeMethod · 0.80
emptyMethod · 0.80
ToStringFunction · 0.70

Tested by

no test coverage detected