[Scummvm-cvs-logs] CVS: scummvm/common config-manager.cpp,1.7,1.8 config-manager.h,1.4,1.5
Max Horn
fingolfin at users.sourceforge.net
Thu Nov 6 16:04:11 CET 2003
Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1:/tmp/cvs-serv9826
Modified Files:
config-manager.cpp config-manager.h
Log Message:
Use the new capabilities of class Map to make the ConfigManager case insensitive when it comes to comparing config keys/domains
Index: config-manager.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/config-manager.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- config-manager.cpp 5 Nov 2003 12:16:14 -0000 1.7
+++ config-manager.cpp 7 Nov 2003 00:03:55 -0000 1.8
@@ -192,7 +192,7 @@
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())
Index: config-manager.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/config-manager.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- config-manager.h 5 Nov 2003 12:16:14 -0000 1.4
+++ config-manager.h 7 Nov 2003 00:03:55 -0000 1.5
@@ -40,23 +40,21 @@
* 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;
More information about the Scummvm-git-logs
mailing list