-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtoml-config.cpp
More file actions
40 lines (38 loc) · 1.21 KB
/
toml-config.cpp
File metadata and controls
40 lines (38 loc) · 1.21 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
#include "toml-config.h"
bool TomlConfig::operator==(const TomlConfig &rhs) const {
return (top_string == rhs.top_string &&
top_int == rhs.top_int &&
top_bool == rhs.top_bool &&
top_array == rhs.top_array &&
top_table == rhs.top_table &&
nested_array == rhs.nested_array &&
nested_table == rhs.nested_table
);
}
std::ostream &operator<<(std::ostream &os, const TomlConfig &s)
{
os << "top_string: " << s.top_string << "\n"
<< "top_int: " << s.top_int << "\n"
<< "top_bool: " << s.top_bool << "\n"
<< "top_array:\n";
for (const auto &item: s.top_array) {
os << " " << item << "\n";
}
os << "top_table:\n";
for (const auto &item: s.top_table) {
os << " " << item.first << ": " << item.second << "\n";
}
for (const auto &item: s.nested_array) {
os << " ListElt" << "\n";
for (const auto &subitem: item) {
os << " " << subitem << "\n";
}
}
for (const auto &item: s.nested_table) {
os << " " << item.first << "\n";
for (const auto &subitem: item.second) {
os << " " << subitem.first << ": " << subitem.second << "\n";
}
}
return os;
}