From 349c47d1229669c3e7c6247065c22fc9e5202ed3 Mon Sep 17 00:00:00 2001 From: gimmedonutnow <gimmedonutnow@users.sf.net> Date: Thu, 17 Aug 2006 21:21:00 +0000 Subject: [PATCH] - added config-file only options --- src/drivers/common/configSys.cpp | 25 +++++++++++++++++++++++++ src/drivers/common/configSys.h | 2 ++ 2 files changed, 27 insertions(+) diff --git a/src/drivers/common/configSys.cpp b/src/drivers/common/configSys.cpp index 194d7819..65a5e11a 100644 --- a/src/drivers/common/configSys.cpp +++ b/src/drivers/common/configSys.cpp @@ -129,6 +129,31 @@ Config::addOption(char shortArg, return 0; } +int +Config::addOption(const std::string &name, + const std::string &defaultValue) +{ + if(_strOptMap.find(name) != _strOptMap.end()) { + return -1; + } + + // add the option + _strOptMap[name] = defaultValue; + return 0; +} + +int +Config::addOption(const std::string &name, + int defaultValue) +{ + if(_intOptMap.find(name) != _intOptMap.end()) { + return -1; + } + + // add the option + _intOptMap[name] = defaultValue; + return 0; +} /** * Sets the specified option to the given integer value. diff --git a/src/drivers/common/configSys.h b/src/drivers/common/configSys.h index 798f90d9..c2a528bf 100644 --- a/src/drivers/common/configSys.h +++ b/src/drivers/common/configSys.h @@ -39,6 +39,8 @@ public: const std::string &, const std::string &); int addOption(char, const std::string &, const std::string &, void (*)(void)); + int addOption(const std::string &, const std::string &); + int addOption(const std::string &, int); /** * Sets a configuration option. Can be called at any time.