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:
@@ -113,6 +113,8 @@ public:
|
|||||||
bool operator>(const char* string) const;
|
bool operator>(const char* string) const;
|
||||||
bool operator!=(const char* string) const;
|
bool operator!=(const char* string) const;
|
||||||
|
|
||||||
|
operator const char*() const;
|
||||||
|
|
||||||
// strcmp()-style compare functions
|
// strcmp()-style compare functions
|
||||||
int Compare(const BString& string) const;
|
int Compare(const BString& string) const;
|
||||||
int Compare(const char* 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
|
inline bool
|
||||||
operator<(const char *str, const BString &string)
|
operator<(const char *str, const BString &string)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user