diff options
author | Max Horn | 2006-03-31 23:10:24 +0000 |
---|---|---|
committer | Max Horn | 2006-03-31 23:10:24 +0000 |
commit | e947bd5e271f35650cb80ac4c75e9ebca77446a1 (patch) | |
tree | 775abb3ff6d9250d7cf0d48edf9ab8b60a60abd1 | |
parent | 05b0ed007e6aef996d0cd4aa15804d468a323c83 (diff) | |
download | scummvm-rg350-e947bd5e271f35650cb80ac4c75e9ebca77446a1.tar.gz scummvm-rg350-e947bd5e271f35650cb80ac4c75e9ebca77446a1.tar.bz2 scummvm-rg350-e947bd5e271f35650cb80ac4c75e9ebca77446a1.zip |
Updated ConfigFile/ConfigManager classes, that work with the updated Map class, and optionally support HashMap (disabled for now)
svn-id: r21519
-rw-r--r-- | common/config-file.h | 3 | ||||
-rw-r--r-- | common/config-manager.h | 19 |
2 files changed, 17 insertions, 5 deletions
diff --git a/common/config-file.h b/common/config-file.h index 8b8b135232..57501b5c73 100644 --- a/common/config-file.h +++ b/common/config-file.h @@ -51,7 +51,8 @@ namespace Common { */ class ConfigFile { public: - typedef Map<String, bool, IgnoreCaseComparator> StringSet; + typedef Map<String, bool, IgnoreCase_Less> StringSet; + //typedef HashMap<String, bool, IgnoreCase_Hash, IgnoreCase_EqualTo> StringSet; struct KeyValue { String key; diff --git a/common/config-manager.h b/common/config-manager.h index f34328e420..452b95d3c6 100644 --- a/common/config-manager.h +++ b/common/config-manager.h @@ -27,16 +27,26 @@ #include "common/array.h" //#include "common/config-file.h" #include "common/map.h" +#include "common/hashmap.h" #include "common/singleton.h" #include "common/str.h" namespace Common { -struct IgnoreCaseComparator { - int operator()(const String& x, const String& y) const { return scumm_stricmp(x.c_str(), y.c_str()); } +struct IgnoreCase_Less { + bool operator()(const String& x, const String& y) const { return scumm_stricmp(x.c_str(), y.c_str()) < 0; } }; -typedef Map<String, String, IgnoreCaseComparator> StringMap; +struct IgnoreCase_EqualTo { + bool operator()(const String& x, const String& y) const { return scumm_stricmp(x.c_str(), y.c_str()) == 0; } +}; + +struct IgnoreCase_Hash { + uint operator()(const String& x) const { return hashit_lower(x.c_str()); } +}; + +typedef Map<String, String, IgnoreCase_Less> StringMap; +//typedef HashMap<String, String, IgnoreCase_Hash, IgnoreCase_EqualTo> StringMap; /** * The (singleton) configuration manager, used to query & set configuration @@ -66,7 +76,8 @@ public: bool hasKVComment(const String &key) const; }; - typedef Map<String, Domain, IgnoreCaseComparator> DomainMap; + typedef Map<String, Domain, IgnoreCase_Less> DomainMap; + //typedef HashMap<String, Domain, IgnoreCase_Hash, IgnoreCase_EqualTo> DomainMap; #if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__)) /** The name of the application domain (normally 'scummvm'). */ |