@@ -16,6 +16,7 @@ labelt::labelt(std::vector<std::string> components) : components(components)
16
16
});
17
17
}));
18
18
}
19
+
19
20
std::string labelt::camel_case () const
20
21
{
21
22
std::ostringstream output;
@@ -24,18 +25,21 @@ std::string labelt::camel_case() const
24
25
output, std::next (components.begin ()), components.end (), " " , capitalize);
25
26
return output.str ();
26
27
}
28
+
27
29
std::string labelt::snake_case () const
28
30
{
29
31
std::ostringstream output;
30
32
join_strings (output, components.begin (), components.end (), ' _' );
31
33
return output.str ();
32
34
}
35
+
33
36
std::string labelt::kebab_case () const
34
37
{
35
38
std::ostringstream output;
36
39
join_strings (output, components.begin (), components.end (), ' -' );
37
40
return output.str ();
38
41
}
42
+
39
43
std::string labelt::pretty () const
40
44
{
41
45
std::ostringstream output;
@@ -47,33 +51,40 @@ std::string labelt::pretty() const
47
51
join_strings (output, range.begin (), range.end (), ' ' );
48
52
return output.str ();
49
53
}
54
+
50
55
bool labelt::operator <(const labelt &other) const
51
56
{
52
57
return components < other.components ;
53
58
}
59
+
54
60
structured_data_entryt structured_data_entryt::data_node (const jsont &data)
55
61
{
56
62
// Structured data (e.g. arrays and objects) should use an entry
57
63
PRECONDITION (!(data.is_array () || data.is_object ()));
58
64
return structured_data_entryt (data);
59
65
}
66
+
60
67
structured_data_entryt
61
68
structured_data_entryt::entry (std::map<labelt, structured_data_entryt> children)
62
69
{
63
70
return structured_data_entryt (children);
64
71
}
72
+
65
73
structured_data_entryt::structured_data_entryt (const jsont &data) : data(data)
66
74
{
67
75
}
76
+
68
77
structured_data_entryt::structured_data_entryt (
69
78
std::map<labelt, structured_data_entryt> children)
70
79
: _children(std::move(children))
71
80
{
72
81
}
82
+
73
83
bool structured_data_entryt::is_leaf () const
74
84
{
75
85
return _children.empty ();
76
86
}
87
+
77
88
std::string structured_data_entryt::leaf_data () const
78
89
{
79
90
return data.value ;
@@ -83,10 +94,12 @@ structured_data_entryt::children() const
83
94
{
84
95
return _children;
85
96
}
97
+
86
98
jsont structured_data_entryt::leaf_object () const
87
99
{
88
100
return data;
89
101
}
102
+
90
103
structured_datat::structured_datat (
91
104
std::map<labelt, structured_data_entryt> data)
92
105
: _data(std::move(data))
@@ -147,6 +160,7 @@ std::string to_pretty(const structured_datat &data)
147
160
join_strings (output, flattened_lines.begin (), flattened_lines.end (), " \n " );
148
161
return output.str ();
149
162
}
163
+
150
164
const std::map<labelt, structured_data_entryt> &structured_datat::data () const
151
165
{
152
166
return _data;
0 commit comments