Use the new capabilities of class Map to make the ConfigManager case insensitive when it comes to comparing config keys/domains

svn-id: r11171
This commit is contained in:
Max Horn 2003-11-07 00:03:55 +00:00
parent 83a55fa7e8
commit 105728adee
2 changed files with 8 additions and 10 deletions

View File

@ -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())

View File

@ -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;