[Scummvm-cvs-logs] SF.net SVN: scummvm: [21519] scummvm/trunk/common

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Mar 31 15:11:04 CEST 2006


Revision: 21519
Author:   fingolfin
Date:     2006-03-31 15:10:24 -0800 (Fri, 31 Mar 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21519&view=rev

Log Message:
-----------
Updated ConfigFile/ConfigManager classes, that work with the updated Map class, and optionally support HashMap (disabled for now)

Modified Paths:
--------------
    scummvm/trunk/common/config-file.h
    scummvm/trunk/common/config-manager.h
Modified: scummvm/trunk/common/config-file.h
===================================================================
--- scummvm/trunk/common/config-file.h	2006-03-31 22:38:27 UTC (rev 21518)
+++ scummvm/trunk/common/config-file.h	2006-03-31 23:10:24 UTC (rev 21519)
@@ -51,7 +51,8 @@
  */
 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;

Modified: scummvm/trunk/common/config-manager.h
===================================================================
--- scummvm/trunk/common/config-manager.h	2006-03-31 22:38:27 UTC (rev 21518)
+++ scummvm/trunk/common/config-manager.h	2006-03-31 23:10:24 UTC (rev 21519)
@@ -27,17 +27,27 @@
 #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
  * values using string keys.
@@ -66,7 +76,8 @@
 		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'). */


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list