|
@@ -44,7 +44,7 @@ void ConfigFileParser::parse(const std::string& path) {
|
44
|
44
|
switch (s) {
|
45
|
45
|
case NONE:
|
46
|
46
|
if (std::isspace(c)) continue;
|
47
|
|
- if (c == '[') {
|
|
47
|
+ if (c == '[' || c == '<') {
|
48
|
48
|
if (tmp.size()) curKV[tmp] = Val{trim(tmp2), valLine, valPos, path};
|
49
|
49
|
tmp.clear();
|
50
|
50
|
tmp2.clear();
|
|
@@ -58,7 +58,8 @@ void ConfigFileParser::parse(const std::string& path) {
|
58
|
58
|
}
|
59
|
59
|
headers.clear();
|
60
|
60
|
curKV.clear();
|
61
|
|
- s = IN_HEAD;
|
|
61
|
+ if (c == '[') s = IN_HEAD;
|
|
62
|
+ if (c == '<') s = IN_INC;
|
62
|
63
|
continue;
|
63
|
64
|
}
|
64
|
65
|
if (isKeyChar(c)) {
|
|
@@ -69,6 +70,19 @@ void ConfigFileParser::parse(const std::string& path) {
|
69
|
70
|
}
|
70
|
71
|
throw ParseExc(l, pos, "header or key", std::string("'") + c + "'",
|
71
|
72
|
path);
|
|
73
|
+
|
|
74
|
+ case IN_INC:
|
|
75
|
+ if (c == '\n') {
|
|
76
|
+ throw ParseExc(l, pos, ">", "<newline>", path);
|
|
77
|
+ } else if (c == '>') {
|
|
78
|
+ parse(tmp);
|
|
79
|
+ tmp.clear();
|
|
80
|
+ s = NONE;
|
|
81
|
+ } else {
|
|
82
|
+ tmp += c;
|
|
83
|
+ }
|
|
84
|
+ continue;
|
|
85
|
+
|
72
|
86
|
case IN_HEAD:
|
73
|
87
|
if (std::isspace(c)) continue;
|
74
|
88
|
if (isKeyChar(c)) {
|
|
@@ -319,6 +333,11 @@ const Val& ConfigFileParser::getVal(Sec section, Key key) const {
|
319
|
333
|
}
|
320
|
334
|
|
321
|
335
|
// _____________________________________________________________________________
|
|
336
|
+const KeyVals& ConfigFileParser::getKeyVals(Sec section) const {
|
|
337
|
+ return _kvs[_secs.find(section)->second];
|
|
338
|
+}
|
|
339
|
+
|
|
340
|
+// _____________________________________________________________________________
|
322
|
341
|
bool ConfigFileParser::hasKey(Sec section, Key key) const {
|
323
|
342
|
if (_secs.find(section) == _secs.end()) return false;
|
324
|
343
|
if (_kvs[_secs.find(section)->second].find(key) ==
|