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.