From bfe0610fc0bf16d8572d2be04e44fb212ef36772 Mon Sep 17 00:00:00 2001 From: Alexander Baldeck Date: Mon, 27 Dec 2004 07:50:49 +0000 Subject: *** empty log message *** --- src/configuration.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/configuration.cpp') diff --git a/src/configuration.cpp b/src/configuration.cpp index 2f794aec..3dccdecf 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -109,7 +109,7 @@ bool Configuration::write(std::string filename) { */ void Configuration::setValue(std::string key, std::string value) { INI_OPTION optionTmp; - if(getValue(key, "") == "") { + if(!keyExists(key)) { #ifdef __DEBUG std::cout << "Configuration::setValue(" << key << ", \"" << value << "\") newly set\n"; #endif @@ -138,7 +138,7 @@ void Configuration::setValue(std::string key, std::string value) { */ void Configuration::setValue(std::string key, float value) { INI_OPTION optionTmp; - if(getValue(key, -111) == -111) { + if(!keyExists(key)) { #ifdef __DEBUG std::cout << "Configuration::setValue(" << key << ", " << value << ") newly set\n"; #endif @@ -186,3 +186,12 @@ float Configuration::getValue(std::string key, float deflt) { return deflt; } + + +bool Configuration::keyExists(std::string key) { + for (iter = iniOptions.begin(); iter != iniOptions.end(); iter++) { + if(iter->key == key) + return true; + } + return false; +} -- cgit v1.2.3-60-g2f50