diff options
author | Max Horn | 2003-11-07 00:03:55 +0000 |
---|---|---|
committer | Max Horn | 2003-11-07 00:03:55 +0000 |
commit | 105728adee99afecee850ae055600692a5de5c47 (patch) | |
tree | 99da8ac9fd5f5e4cd4285a4e33c09bc29a87e593 /common | |
parent | 83a55fa7e87bdf75c824f068dd0b2e49468dc6d7 (diff) | |
download | scummvm-rg350-105728adee99afecee850ae055600692a5de5c47.tar.gz scummvm-rg350-105728adee99afecee850ae055600692a5de5c47.tar.bz2 scummvm-rg350-105728adee99afecee850ae055600692a5de5c47.zip |
Use the new capabilities of class Map to make the ConfigManager case insensitive when it comes to comparing config keys/domains
svn-id: r11171
Diffstat (limited to 'common')
-rw-r--r-- | common/config-manager.cpp | 2 | ||||
-rw-r--r-- | common/config-manager.h | 16 |
2 files changed, 8 insertions, 10 deletions
diff --git a/common/config-manager.cpp b/common/config-manager.cpp index 1bcc06ff19..4ecc0e467c 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -192,7 +192,7 @@ void ConfigManager::writeDomain(FILE *file, const String &name, const Domain &do fprintf(file, "[%s]\n", name.c_str()); - StringMap::ConstIterator x; + Domain::ConstIterator x; for (x = domain.begin(); x != domain.end(); ++x) { const String &value = x->_value; if (!value.isEmpty()) diff --git a/common/config-manager.h b/common/config-manager.h index 83f589aafc..d134a48f7a 100644 --- a/common/config-manager.h +++ b/common/config-manager.h @@ -40,23 +40,21 @@ namespace Common { * of some specific (or any) configuration key changes. */ class ConfigManager : public Singleton<ConfigManager> { + struct IgnoreCaseComperator { + int operator()(const String& x, const String& y) const { return scumm_stricmp(x.c_str(), y.c_str()); } + }; + public: - class Domain : public StringMap { -// friend class ConfigManager; + class Domain : public Map<String, String, IgnoreCaseComperator> { public: const String &get(const String &key) const { Node *node = findNode(_root, key); return node ? node->_value : String::emptyString; } -/* - void set(const String &key, const String &value); - void set(const String &key, int value); - void set(const String &key, bool value); -*/ }; - typedef Map<String, Domain> DomainMap; - + typedef Map<String, Domain, IgnoreCaseComperator> DomainMap; + /** The name of the application domain (normally 'scummvm'). */ static const String kApplicationDomain; |