Added operator + for strings
svn-id: r14093
This commit is contained in:
parent
d4f071c6c6
commit
4744538752
2 changed files with 27 additions and 0 deletions
|
@ -255,6 +255,28 @@ bool ConstString::operator >= (const ConstString &x) const {
|
||||||
return (x <= *this);
|
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) {
|
bool operator == (const char* y, const ConstString &x) {
|
||||||
return (x == y);
|
return (x == y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,6 +122,11 @@ protected:
|
||||||
void decRefCount();
|
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
|
// Some useful additional comparision operators for Strings
|
||||||
bool operator == (const char *x, const ConstString &y);
|
bool operator == (const char *x, const ConstString &y);
|
||||||
bool operator != (const char *x, const ConstString &y);
|
bool operator != (const char *x, const ConstString &y);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue