summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/configparser.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/configparser.cpp b/src/configparser.cpp
index 22c3679ab..44eb117a8 100644
--- a/src/configparser.cpp
+++ b/src/configparser.cpp
@@ -84,7 +84,7 @@ struct Parser
unget(ch);
}
- bool kv()
+ bool kv(std::vector<KeyVal>* items)
{
std::string key;
nextword(key);
@@ -138,7 +138,7 @@ struct Parser
break;
value.push_back(ch);
}
- tag->items.push_back(KeyVal(key, value));
+ items->push_back(KeyVal(key, value));
return true;
}
@@ -157,9 +157,10 @@ struct Parser
if (name.empty())
throw CoreException("Empty tag name");
- tag = new ConfigTag(name, current.filename, current.line);
+ std::vector<KeyVal>* items;
+ tag = ConfigTag::create(name, current.filename, current.line, items);
- while (kv());
+ while (kv(items));
if (name == "include")
{
@@ -376,6 +377,18 @@ std::string ConfigTag::getTagLocation()
return src_name + ":" + ConvToStr(src_line);
}
+ConfigTag* ConfigTag::create(const std::string& Tag, const std::string& file, int line, std::vector<KeyVal>*&items)
+{
+ ConfigTag* rv = new ConfigTag(Tag, file, line);
+ items = &rv->items;
+ return rv;
+}
+
+ConfigTag::ConfigTag(const std::string& Tag, const std::string& file, int line)
+ : tag(Tag), src_name(file), src_line(line)
+{
+}
+
std::string OperInfo::getConfig(const std::string& key)
{
std::string rv;