Added (const char*) cast operator. That makes BString more convenient to pass

around, particularly returning it from methods instead of a const char*, if the
object stores the string as a BString anyway, thus leveraging CoW.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31354 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-07-01 13:11:30 +00:00
parent 05218580c7
commit ff293f209a
+9
View File
@@ -113,6 +113,8 @@ public:
bool operator>(const char* string) const;
bool operator!=(const char* string) const;
operator const char*() const;
// strcmp()-style compare functions
int Compare(const BString& string) const;
int Compare(const char* string) const;
@@ -423,6 +425,13 @@ BString::operator!=(const char* string) const
}
inline
BString::operator const char*() const
{
return String();
}
inline bool
operator<(const char *str, const BString &string)
{