|
@@ -16,17 +16,30 @@ using namespace configparser;
|
16
|
16
|
ConfigFileParser::ConfigFileParser() {}
|
17
|
17
|
|
18
|
18
|
// _____________________________________________________________________________
|
|
19
|
+void ConfigFileParser::parseStr(const std::string& str) {
|
|
20
|
+ std::stringstream ss;
|
|
21
|
+ ss << str;
|
|
22
|
+ parse(ss, "<string literal>");
|
|
23
|
+}
|
|
24
|
+
|
|
25
|
+// _____________________________________________________________________________
|
19
|
26
|
void ConfigFileParser::parse(const std::string& path) {
|
20
|
|
- State s = NONE;
|
21
|
|
- std::set<std::string> headers;
|
22
|
|
- KeyVals curKV;
|
23
|
|
- std::string tmp, tmp2;
|
24
|
27
|
std::ifstream is(path);
|
25
|
28
|
|
26
|
29
|
if (!is.good()) {
|
27
|
30
|
throw ParseFileExc(path);
|
28
|
31
|
}
|
29
|
32
|
|
|
33
|
+ parse(is, path);
|
|
34
|
+}
|
|
35
|
+
|
|
36
|
+// _____________________________________________________________________________
|
|
37
|
+void ConfigFileParser::parse(std::istream& is, const std::string& path) {
|
|
38
|
+ State s = NONE;
|
|
39
|
+ std::set<std::string> headers;
|
|
40
|
+ KeyVals curKV;
|
|
41
|
+ std::string tmp, tmp2;
|
|
42
|
+
|
30
|
43
|
char c;
|
31
|
44
|
size_t l = 1, pos = 0, valLine = 0, valPos = 0;
|
32
|
45
|
|