diff options
author | Max Horn | 2004-06-27 23:58:41 +0000 |
---|---|---|
committer | Max Horn | 2004-06-27 23:58:41 +0000 |
commit | 4744538752a94e922c81e169eb7754d4a7367b64 (patch) | |
tree | ae3cdac487fc98c5486782504f86437dd0b36543 | |
parent | d4f071c6c69711f0330754ad7f971bb666298941 (diff) | |
download | scummvm-rg350-4744538752a94e922c81e169eb7754d4a7367b64.tar.gz scummvm-rg350-4744538752a94e922c81e169eb7754d4a7367b64.tar.bz2 scummvm-rg350-4744538752a94e922c81e169eb7754d4a7367b64.zip |
Added operator + for strings
svn-id: r14093
-rw-r--r-- | common/str.cpp | 22 | ||||
-rw-r--r-- | common/str.h | 5 |
2 files changed, 27 insertions, 0 deletions
diff --git a/common/str.cpp b/common/str.cpp index 3691088e6a..cd2bd631ac 100644 --- a/common/str.cpp +++ b/common/str.cpp @@ -255,6 +255,28 @@ bool ConstString::operator >= (const ConstString &x) const { 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); } diff --git a/common/str.h b/common/str.h index 8697ca2871..d6354481d5 100644 --- a/common/str.h +++ b/common/str.h @@ -122,6 +122,11 @@ protected: 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); |