[Scummvm-cvs-logs] SF.net SVN: scummvm: [32797] scummvm/branches/gsoc2008-gui/common

Tanoku at users.sourceforge.net Tanoku at users.sourceforge.net
Thu Jun 26 11:18:41 CEST 2008


Revision: 32797
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32797&view=rev
Author:   Tanoku
Date:     2008-06-26 02:18:41 -0700 (Thu, 26 Jun 2008)

Log Message:
-----------
Actually reverted stupid changes in Common::String and Util.cpp regarding Regex and the platform function.

Modified Paths:
--------------
    scummvm/branches/gsoc2008-gui/common/str.cpp
    scummvm/branches/gsoc2008-gui/common/str.h
    scummvm/branches/gsoc2008-gui/common/util.cpp
    scummvm/branches/gsoc2008-gui/common/util.h

Modified: scummvm/branches/gsoc2008-gui/common/str.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/common/str.cpp	2008-06-26 07:13:05 UTC (rev 32796)
+++ scummvm/branches/gsoc2008-gui/common/str.cpp	2008-06-26 09:18:41 UTC (rev 32797)
@@ -283,105 +283,6 @@
 		_str[i] = toupper(_str[i]);
 }
 
-bool String::regexMatch(const char *regex, bool skipSpaces) {
-	int pos = 0;
-
-	if (regex[0] == '^')
-		return regexMatchPos(1, regex, 1, skipSpaces);
-
-	do {
-		if (regexMatchPos(pos, regex, 0, skipSpaces))
-			return true;
-	} while (_str[pos++]);
-
-	return false;
-}
-
-bool String::regexMatchCharacter(RegexMatchType type, char regexChar, char strChar) {
-	switch (type) {
-		case kRegexMatchAny:
-			return true;
-
-		case kRegexMatchDigit:
-			return isdigit(strChar) != 0;
-
-		case kRegexMatchSpace:
-			return isspace(strChar) != 0;
-
-		case kRegexMatchAlphanum:
-			return isalnum(strChar) != 0;
-
-		case kRegexMatchAlpha:
-			return isalpha(strChar) != 0;
-
-		case kRegexMatchWord:
-			return isalnum(strChar) != 0 || strChar == '_';
-
-		case kRegexMatchCharacter:
-			return regexChar == strChar;
-
-		default:
-			return false;
-	}
-}
-
-bool String::regexMatchStar(RegexMatchType type, char regexChar, const char *regex, int regexPos, int strPos, bool skipSpaces) {
-
-	do {
-		if (regexMatchPos(strPos, regex, regexPos, skipSpaces))
-			return true;
-	} while (_str[strPos] && regexMatchCharacter(type, regexChar, _str[strPos++]));
-
-	return false;
-}
-
-bool String::regexMatchPos(int strPos, const char *regex, int regexPos, bool skipSpaces) {
-	RegexMatchType matchT = kRegexMatchCharacter;
-
-	if (skipSpaces) {
-		while (isspace(_str[strPos]))
-			strPos++;
-
-		while (isspace(regex[regexPos]))
-			regexPos++;
-	}
-
-	if (regex[regexPos] == '\0')
-		return true;
-
-	if (regex[regexPos] == '.')
-		matchT = kRegexMatchAny;
-	else if (regex[regexPos] == '[') {
-		String group;
-		while (regex[regexPos - 1] != ']')
-			group += regex[regexPos++];
-
-		regexPos--;
-
-		if (group == "[digit]" || group == "[d]")
-			matchT = kRegexMatchDigit;
-		else if (group == "[space]" || group == "[s]")
-			matchT = kRegexMatchSpace;
-		else if (group == "[alnum]")
-			matchT = kRegexMatchAlphanum;
-		else if (group == "[alpha]")
-			matchT = kRegexMatchAlpha;
-		else if (group == "[word]")
-			matchT = kRegexMatchWord;
-	}
-
-	if (regex[regexPos + 1] == '*')
-		return regexMatchStar(matchT, regex[regexPos], regex, regexPos + 2, strPos, skipSpaces);
-
-	if (regex[regexPos] == '$' && regex[regexPos + 1] == 0)
-		return _str[strPos] == 0;
-
-	if (_str[strPos] && regexMatchCharacter(matchT, regex[regexPos], _str[strPos]))
-		return regexMatchPos(strPos + 1, regex, regexPos + 1, skipSpaces);
-
-	return false;
-}
-
 /**
  * Ensure that enough storage is available to store at least new_len
  * characters plus a null byte. In addition, if we currently share

Modified: scummvm/branches/gsoc2008-gui/common/str.h
===================================================================
--- scummvm/branches/gsoc2008-gui/common/str.h	2008-06-26 07:13:05 UTC (rev 32796)
+++ scummvm/branches/gsoc2008-gui/common/str.h	2008-06-26 09:18:41 UTC (rev 32797)
@@ -165,9 +165,6 @@
 
 	uint hash() const;
 
-	// Tanoku: Regular expression support for the String class
-	bool regexMatch(const char *regex, bool skipSpaces = false);
-
 public:
 	typedef char *        iterator;
 	typedef const char *  const_iterator;
@@ -192,20 +189,6 @@
 	void ensureCapacity(uint32 new_len, bool keep_old);
 	void incRefCount() const;
 	void decRefCount(int *oldRefCount);
-
-	enum RegexMatchType {
-		kRegexMatchAny,
-		kRegexMatchDigit,
-		kRegexMatchSpace,
-		kRegexMatchAlphanum,
-		kRegexMatchAlpha,
-		kRegexMatchWord,
-		kRegexMatchCharacter
-	};
-
-	bool regexMatchStar(RegexMatchType type, char regexChar, const char *regex, int regexPos, int strPos, bool skipSpaces);
-	bool regexMatchCharacter(RegexMatchType type, char regexChar, char strChar);
-	bool regexMatchPos(int strPos, const char *regex, int regexPos, bool skipSpaces);
 };
 
 // Append two strings to form a new (temp) string

Modified: scummvm/branches/gsoc2008-gui/common/util.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/common/util.cpp	2008-06-26 07:13:05 UTC (rev 32796)
+++ scummvm/branches/gsoc2008-gui/common/util.cpp	2008-06-26 09:18:41 UTC (rev 32797)
@@ -481,35 +481,7 @@
 	return gDebugLevelsEnabled;
 }
 
-const char *getHostPlatformString() {
 
-#if defined(__SYMBIAN32__)
-	return "symbian";
-#elif defined(_WIN32_WCE) || defined(_MSC_VER) || defined(__MINGW32__) || defined(UNIX)
-	return "pc";
-#elif defined(__PALMOS_TRAPS__)	|| defined (__PALMOS_ARMLET__)
-	return "palmos";
-#elif defined(__DC__)
-	return "dc";
-#elif defined(__GP32__)
-	return "gp32";
-#elif defined(__PLAYSTATION2__)
-	return "ps2";
-#elif defined(__PSP__)
-	return "psp";
-#elif defined(__amigaos4__)
-	return "amigaos";
-#elif defined (__DS__) //NeilM
-	return "nds";
-#elif defined(__WII__)
-	return "wii";
-#else
-	return "";
-#endif
-
-}
-
-
 }	// End of namespace Common
 
 
@@ -722,4 +694,3 @@
 	str[4] = '\0';
 	return Common::String(str);
 }
-

Modified: scummvm/branches/gsoc2008-gui/common/util.h
===================================================================
--- scummvm/branches/gsoc2008-gui/common/util.h	2008-06-26 07:13:05 UTC (rev 32796)
+++ scummvm/branches/gsoc2008-gui/common/util.h	2008-06-26 09:18:41 UTC (rev 32797)
@@ -323,13 +323,6 @@
 uint32 getEnabledSpecialDebugLevels();
 
 
-/**
- * Return a string containing the name of the currently running host.
- * E.g. returns "wii" if ScummVM is being run in a Wii, and so on.
- */
-const char *getHostPlatformString();
-
-
 }	// End of namespace Common
 
 


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