summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Baldeck <alexander@archlinux.org>2004-12-27 07:50:49 +0000
committerAlexander Baldeck <alexander@archlinux.org>2004-12-27 07:50:49 +0000
commitbfe0610fc0bf16d8572d2be04e44fb212ef36772 (patch)
tree4fa3cdc032101af0132c6b8b7c34cfa5f504ef9a /src
parent78f1aaf1dc6ddbacd0bd13f5f082e1f88cb02f47 (diff)
downloadmana-bfe0610fc0bf16d8572d2be04e44fb212ef36772.tar.gz
mana-bfe0610fc0bf16d8572d2be04e44fb212ef36772.tar.bz2
mana-bfe0610fc0bf16d8572d2be04e44fb212ef36772.tar.xz
mana-bfe0610fc0bf16d8572d2be04e44fb212ef36772.zip
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/configuration.cpp13
-rw-r--r--src/configuration.h1
2 files changed, 12 insertions, 2 deletions
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;
+}
diff --git a/src/configuration.h b/src/configuration.h
index db99007c..45c443f8 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -47,6 +47,7 @@ class Configuration {
std::string getValue(std::string, std::string);
float getValue(std::string, float);
private:
+ bool keyExists(std::string);
typedef struct INI_OPTION {
std::string key;