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