summaryrefslogtreecommitdiffstats
path: root/src/Common
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/ConfigManager.cpp14
-rw-r--r--src/Common/ConfigManager.h2
-rw-r--r--src/Common/Configurable.h2
3 files changed, 9 insertions, 9 deletions
diff --git a/src/Common/ConfigManager.cpp b/src/Common/ConfigManager.cpp
index fbd73ea..20a6110 100644
--- a/src/Common/ConfigManager.cpp
+++ b/src/Common/ConfigManager.cpp
@@ -31,16 +31,16 @@ namespace Common {
ConfigManager ConfigManager::configManager;
-void ConfigManager::handleConfigEntry(const std::vector<std::string> &entry, const std::vector<std::vector<std::string> > &section) {
+void ConfigManager::handleConfigEntry(const std::vector<std::vector<std::string> > &entry) {
bool handled = false;
for(std::set<Configurable*>::iterator c = configurables.begin(); c != configurables.end(); ++c) {
- if((*c)->handleConfigEntry(entry, section))
+ if((*c)->handleConfigEntry(entry))
handled = true;
}
if(!handled)
- Logger::logf(Logger::WARNING, "Unknown config option '%s'.", entry.front().c_str());
+ Logger::logf(Logger::WARNING, "Invalid config option '%s'.", entry.back().front().c_str());
}
bool ConfigManager::loadFile(const std::string &filename, bool finish) {
@@ -87,15 +87,15 @@ bool ConfigManager::loadFile(const std::string &filename, bool finish) {
if(pos == std::string::npos) {
entry.push_back(line);
-
- handleConfigEntry(entry, section);
}
else {
entry.push_back(line.substr(0, pos));
entry.push_back(Util::trim(line.substr(pos)));
-
- handleConfigEntry(entry, section);
}
+
+ section.push_back(entry);
+ handleConfigEntry(section);
+ section.pop_back();
}
switch(bracket) {
diff --git a/src/Common/ConfigManager.h b/src/Common/ConfigManager.h
index 7fa781e..ccf5d13 100644
--- a/src/Common/ConfigManager.h
+++ b/src/Common/ConfigManager.h
@@ -38,7 +38,7 @@ class ConfigManager {
ConfigManager() : finished(false) {}
- void handleConfigEntry(const std::vector<std::string>&, const std::vector<std::vector<std::string> >&);
+ void handleConfigEntry(const std::vector<std::vector<std::string> > &entry);
public:
bool loadFile(const std::string &filename, bool finish = true);
diff --git a/src/Common/Configurable.h b/src/Common/Configurable.h
index 350b444..0c471c7 100644
--- a/src/Common/Configurable.h
+++ b/src/Common/Configurable.h
@@ -32,7 +32,7 @@ class Configurable {
protected:
friend class ConfigManager;
- virtual bool handleConfigEntry(const std::vector<std::string>&, const std::vector<std::vector<std::string> >&) {return false;}
+ virtual bool handleConfigEntry(const std::vector<std::vector<std::string> >&) {return false;}
virtual void configFinished() {}
};