[Scummvm-cvs-logs] CVS: scummvm/common str.cpp,1.30,1.31 str.h,1.21,1.22

Max Horn fingolfin at users.sourceforge.net
Sun Jun 27 16:59:02 CEST 2004


Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4825

Modified Files:
	str.cpp str.h 
Log Message:
Added operator + for strings

Index: str.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/str.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- str.cpp	25 Mar 2004 11:25:50 -0000	1.30
+++ str.cpp	27 Jun 2004 23:58:41 -0000	1.31
@@ -255,6 +255,28 @@
 	return (x <= *this);
 }
 
+#pragma mark -
+
+String operator +(const String &x, const String &y) {
+	String temp(x);
+	temp += y;
+	return temp;
+}
+
+String operator +(const char *x, const String &y) {
+	String temp(x);
+	temp += y;
+	return temp;
+}
+
+String operator +(const String &x, const char *y) {
+	String temp(x);
+	temp += y;
+	return temp;
+}
+
+#pragma mark -
+
 bool operator == (const char* y, const ConstString &x) {
 	return (x == y);
 }

Index: str.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/str.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- str.h	9 Apr 2004 15:10:22 -0000	1.21
+++ str.h	27 Jun 2004 23:58:41 -0000	1.22
@@ -122,6 +122,11 @@
 	void decRefCount();
 };
 
+// Append two strings to form a new (temp) string
+String operator +(const String &x, const String &y);
+String operator +(const char *x, const String &y);
+String operator +(const String &x, const char *y);
+
 // Some useful additional comparision operators for Strings
 bool operator == (const char *x, const ConstString &y);
 bool operator != (const char *x, const ConstString &y);





More information about the Scummvm-git-logs mailing list