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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sat Mar 20 13:56:57 CET 2010


Revision: 48310
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48310&view=rev
Author:   lordhoto
Date:     2010-03-20 12:56:56 +0000 (Sat, 20 Mar 2010)

Log Message:
-----------
Move StringTokenizer to its own files (tokenizer.h/tokenizer.cpp).

Modified Paths:
--------------
    scummvm/trunk/base/main.cpp
    scummvm/trunk/common/module.mk
    scummvm/trunk/common/util.cpp
    scummvm/trunk/common/util.h
    scummvm/trunk/engines/parallaction/balloons.cpp
    scummvm/trunk/gui/ListWidget.cpp
    scummvm/trunk/gui/ThemeEngine.cpp
    scummvm/trunk/gui/ThemeEval.cpp
    scummvm/trunk/gui/ThemeParser.cpp

Added Paths:
-----------
    scummvm/trunk/common/tokenizer.cpp
    scummvm/trunk/common/tokenizer.h

Modified: scummvm/trunk/base/main.cpp
===================================================================
--- scummvm/trunk/base/main.cpp	2010-03-20 12:18:56 UTC (rev 48309)
+++ scummvm/trunk/base/main.cpp	2010-03-20 12:56:56 UTC (rev 48310)
@@ -45,6 +45,7 @@
 #include "common/file.h"
 #include "common/fs.h"
 #include "common/system.h"
+#include "common/tokenizer.h"
 
 #include "gui/GuiManager.h"
 #include "gui/message.h"

Modified: scummvm/trunk/common/module.mk
===================================================================
--- scummvm/trunk/common/module.mk	2010-03-20 12:18:56 UTC (rev 48309)
+++ scummvm/trunk/common/module.mk	2010-03-20 12:56:56 UTC (rev 48310)
@@ -20,6 +20,7 @@
 	stream.o \
 	util.o \
 	system.o \
+	tokenizer.o \
 	unarj.o \
 	unzip.o \
 	xmlparser.o \

Added: scummvm/trunk/common/tokenizer.cpp
===================================================================
--- scummvm/trunk/common/tokenizer.cpp	                        (rev 0)
+++ scummvm/trunk/common/tokenizer.cpp	2010-03-20 12:56:56 UTC (rev 48310)
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#include "common/tokenizer.h"
+
+namespace Common {
+
+StringTokenizer::StringTokenizer(const String &str, const String &delimiters) : _str(str), _delimiters(delimiters) {
+	reset();
+}
+
+void StringTokenizer::reset() {
+	_tokenBegin = _tokenEnd = 0;
+}
+
+bool StringTokenizer::empty() const {
+	// Search for the next token's start (i.e. the next non-delimiter character)
+	for (uint i = _tokenEnd; i < _str.size(); i++) {
+		if (!_delimiters.contains(_str[i]))
+			return false; // Found a token so the tokenizer is not empty
+	}
+	// Didn't find any more tokens so the tokenizer is empty
+	return true;
+}
+
+String StringTokenizer::nextToken() {
+	// Seek to next token's start (i.e. jump over the delimiters before next token)
+	for (_tokenBegin = _tokenEnd; _tokenBegin < _str.size() && _delimiters.contains(_str[_tokenBegin]); _tokenBegin++)
+		;
+	// Seek to the token's end (i.e. jump over the non-delimiters)
+	for (_tokenEnd = _tokenBegin; _tokenEnd < _str.size() && !_delimiters.contains(_str[_tokenEnd]); _tokenEnd++)
+		;
+	// Return the found token
+	return String(_str.c_str() + _tokenBegin, _tokenEnd - _tokenBegin);
+}
+
+} // End of namespace Common
+


Property changes on: scummvm/trunk/common/tokenizer.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Added: scummvm/trunk/common/tokenizer.h
===================================================================
--- scummvm/trunk/common/tokenizer.h	                        (rev 0)
+++ scummvm/trunk/common/tokenizer.h	2010-03-20 12:56:56 UTC (rev 48310)
@@ -0,0 +1,61 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#ifndef COMMON_TOKENIZER_H
+#define COMMON_TOKENIZER_H
+
+#include "common/scummsys.h"
+#include "common/str.h"
+
+namespace Common {
+
+/**
+ * A simple non-optimized string tokenizer.
+ *
+ * Example of use:
+ * StringTokenizer("Now, this is a test!", " ,!") gives tokens "Now", "this", "is", "a" and "test" using nextToken().
+ */
+class StringTokenizer {
+public:
+	/**
+	 * Creates a StringTokenizer.
+	 * @param str The string to be tokenized.
+	 * @param delimiters String containing all the delimiter characters (i.e. the characters to be ignored).
+	 * @note Uses space, horizontal tab, carriage return, newline, form feed and vertical tab as delimiters by default.
+	 */
+	StringTokenizer(const String &str, const String &delimiters = " \t\r\n\f\v");
+	void reset();       ///< Resets the tokenizer to its initial state
+	bool empty() const; ///< Returns true if there are no more tokens left in the string, false otherwise
+	String nextToken(); ///< Returns the next token from the string (Or an empty string if there are no more tokens)
+
+private:
+	const String _str;        ///< The string to be tokenized
+	const String _delimiters; ///< String containing all the delimiter characters
+	uint         _tokenBegin; ///< Latest found token's begin (Valid after a call to nextToken(), zero otherwise)
+	uint         _tokenEnd;   ///< Latest found token's end (Valid after a call to nextToken(), zero otherwise)
+};
+
+} // End of namespace Common
+
+#endif


Property changes on: scummvm/trunk/common/tokenizer.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: scummvm/trunk/common/util.cpp
===================================================================
--- scummvm/trunk/common/util.cpp	2010-03-20 12:18:56 UTC (rev 48309)
+++ scummvm/trunk/common/util.cpp	2010-03-20 12:56:56 UTC (rev 48310)
@@ -30,39 +30,6 @@
 
 namespace Common {
 
-StringTokenizer::StringTokenizer(const String &str, const String &delimiters) : _str(str), _delimiters(delimiters) {
-	reset();
-}
-
-void StringTokenizer::reset() {
-	_tokenBegin = _tokenEnd = 0;
-}
-
-bool StringTokenizer::empty() const {
-	// Search for the next token's start (i.e. the next non-delimiter character)
-	for (uint i = _tokenEnd; i < _str.size(); i++) {
-		if (!_delimiters.contains(_str[i]))
-			return false; // Found a token so the tokenizer is not empty
-	}
-	// Didn't find any more tokens so the tokenizer is empty
-	return true;
-}
-
-String StringTokenizer::nextToken() {
-	// Seek to next token's start (i.e. jump over the delimiters before next token)
-	for (_tokenBegin = _tokenEnd; _tokenBegin < _str.size() && _delimiters.contains(_str[_tokenBegin]); _tokenBegin++)
-		;
-	// Seek to the token's end (i.e. jump over the non-delimiters)
-	for (_tokenEnd = _tokenBegin; _tokenEnd < _str.size() && !_delimiters.contains(_str[_tokenEnd]); _tokenEnd++)
-		;
-	// Return the found token
-	return String(_str.c_str() + _tokenBegin, _tokenEnd - _tokenBegin);
-}
-
-
-#pragma mark -
-
-
 //
 // Print hexdump of the data passed in
 //

Modified: scummvm/trunk/common/util.h
===================================================================
--- scummvm/trunk/common/util.h	2010-03-20 12:18:56 UTC (rev 48309)
+++ scummvm/trunk/common/util.h	2010-03-20 12:56:56 UTC (rev 48310)
@@ -66,32 +66,6 @@
 namespace Common {
 
 /**
- * A simple non-optimized string tokenizer.
- *
- * Example of use:
- * StringTokenizer("Now, this is a test!", " ,!") gives tokens "Now", "this", "is", "a" and "test" using nextToken().
- */
-class StringTokenizer {
-public:
-	/**
-	 * Creates a StringTokenizer.
-	 * @param str The string to be tokenized.
-	 * @param delimiters String containing all the delimiter characters (i.e. the characters to be ignored).
-	 * @note Uses space, horizontal tab, carriage return, newline, form feed and vertical tab as delimiters by default.
-	 */
-	StringTokenizer(const String &str, const String &delimiters = " \t\r\n\f\v");
-	void reset();       ///< Resets the tokenizer to its initial state
-	bool empty() const; ///< Returns true if there are no more tokens left in the string, false otherwise
-	String nextToken(); ///< Returns the next token from the string (Or an empty string if there are no more tokens)
-
-private:
-	const String _str;        ///< The string to be tokenized
-	const String _delimiters; ///< String containing all the delimiter characters
-	uint         _tokenBegin; ///< Latest found token's begin (Valid after a call to nextToken(), zero otherwise)
-	uint         _tokenEnd;   ///< Latest found token's end (Valid after a call to nextToken(), zero otherwise)
-};
-
-/**
  * Print a hexdump of the data passed in. The number of bytes per line is
  * customizable.
  * @param data	the data to be dumped

Modified: scummvm/trunk/engines/parallaction/balloons.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/balloons.cpp	2010-03-20 12:18:56 UTC (rev 48309)
+++ scummvm/trunk/engines/parallaction/balloons.cpp	2010-03-20 12:56:56 UTC (rev 48310)
@@ -23,11 +23,11 @@
  *
  */
 
-#include "common/util.h"
-
 #include "parallaction/graphics.h"
 #include "parallaction/parallaction.h"
 
+#include "common/tokenizer.h"
+
 namespace Parallaction {
 
 class WrappedLineFormatter {

Modified: scummvm/trunk/gui/ListWidget.cpp
===================================================================
--- scummvm/trunk/gui/ListWidget.cpp	2010-03-20 12:18:56 UTC (rev 48309)
+++ scummvm/trunk/gui/ListWidget.cpp	2010-03-20 12:56:56 UTC (rev 48310)
@@ -25,6 +25,7 @@
 #include "common/system.h"
 #include "common/events.h"
 #include "common/frac.h"
+#include "common/tokenizer.h"
 
 #include "gui/ListWidget.h"
 #include "gui/ScrollBarWidget.h"

Modified: scummvm/trunk/gui/ThemeEngine.cpp
===================================================================
--- scummvm/trunk/gui/ThemeEngine.cpp	2010-03-20 12:18:56 UTC (rev 48309)
+++ scummvm/trunk/gui/ThemeEngine.cpp	2010-03-20 12:56:56 UTC (rev 48310)
@@ -23,13 +23,13 @@
  *
  */
 
-#include "common/util.h"
 #include "common/system.h"
 #include "common/events.h"
 #include "common/config-manager.h"
 #include "common/file.h"
 #include "common/fs.h"
 #include "common/unzip.h"
+#include "common/tokenizer.h"
 
 #include "graphics/colormasks.h"
 #include "graphics/cursorman.h"

Modified: scummvm/trunk/gui/ThemeEval.cpp
===================================================================
--- scummvm/trunk/gui/ThemeEval.cpp	2010-03-20 12:18:56 UTC (rev 48309)
+++ scummvm/trunk/gui/ThemeEval.cpp	2010-03-20 12:56:56 UTC (rev 48310)
@@ -28,6 +28,8 @@
 
 #include "graphics/scaler.h"
 
+#include "common/tokenizer.h"
+
 namespace GUI {
 
 ThemeEval::~ThemeEval() {

Modified: scummvm/trunk/gui/ThemeParser.cpp
===================================================================
--- scummvm/trunk/gui/ThemeParser.cpp	2010-03-20 12:18:56 UTC (rev 48309)
+++ scummvm/trunk/gui/ThemeParser.cpp	2010-03-20 12:56:56 UTC (rev 48310)
@@ -30,6 +30,8 @@
 
 #include "graphics/VectorRenderer.h"
 
+#include "common/tokenizer.h"
+
 namespace GUI {
 
 struct TextDataInfo {


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