|
|
/** | /** |
* FXString provides essential string manipulation capabilities. | * FXString provides essential string manipulation capabilities. |
*/ | */ |
|
class FXString; |
|
|
|
/// Compare |
|
FXAPI FXint compare(const FXchar* s1,const FXchar* s2); |
|
FXAPI FXint compare(const FXchar* s1,const FXString& s2); |
|
FXAPI FXint compare(const FXString& s1,const FXchar* s2); |
|
FXAPI FXint compare(const FXString& s1,const FXString& s2); |
|
|
|
/// Compare up to n |
|
FXAPI FXint compare(const FXchar* s1,const FXchar* s2,FXint n); |
|
FXAPI FXint compare(const FXchar* s1,const FXString& s2,FXint n); |
|
FXAPI FXint compare(const FXString& s1,const FXchar* s2,FXint n); |
|
FXAPI FXint compare(const FXString& s1,const FXString& s2,FXint n); |
|
|
|
/// Compare case insensitive |
|
FXAPI FXint comparecase(const FXchar* s1,const FXchar* s2); |
|
FXAPI FXint comparecase(const FXchar* s1,const FXString& s2); |
|
FXAPI FXint comparecase(const FXString& s1,const FXchar* s2); |
|
FXAPI FXint comparecase(const FXString& s1,const FXString& s2); |
|
|
|
/// Compare case insensitive up to n |
|
FXAPI FXint comparecase(const FXchar* s1,const FXchar* s2,FXint n); |
|
FXAPI FXint comparecase(const FXchar* s1,const FXString& s2,FXint n); |
|
FXAPI FXint comparecase(const FXString& s1,const FXchar* s2,FXint n); |
|
FXAPI FXint comparecase(const FXString& s1,const FXString& s2,FXint n); |
|
|
|
/// Comparison operators |
|
FXAPI FXbool operator==(const FXString& s1,const FXString& s2); |
|
FXAPI FXbool operator==(const FXString& s1,const FXchar* s2); |
|
FXAPI FXbool operator==(const FXchar* s1,const FXString& s2); |
|
|
|
FXAPI FXbool operator!=(const FXString& s1,const FXString& s2); |
|
FXAPI FXbool operator!=(const FXString& s1,const FXchar* s2); |
|
FXAPI FXbool operator!=(const FXchar* s1,const FXString& s2); |
|
|
|
FXAPI FXbool operator<(const FXString& s1,const FXString& s2); |
|
FXAPI FXbool operator<(const FXString& s1,const FXchar* s2); |
|
FXAPI FXbool operator<(const FXchar* s1,const FXString& s2); |
|
|
|
FXAPI FXbool operator<=(const FXString& s1,const FXString& s2); |
|
FXAPI FXbool operator<=(const FXString& s1,const FXchar* s2); |
|
FXAPI FXbool operator<=(const FXchar* s1,const FXString& s2); |
|
|
|
FXAPI FXbool operator>(const FXString& s1,const FXString& s2); |
|
FXAPI FXbool operator>(const FXString& s1,const FXchar* s2); |
|
FXAPI FXbool operator>(const FXchar* s1,const FXString& s2); |
|
|
|
FXAPI FXbool operator>=(const FXString& s1,const FXString& s2); |
|
FXAPI FXbool operator>=(const FXString& s1,const FXchar* s2); |
|
FXAPI FXbool operator>=(const FXchar* s1,const FXString& s2); |
|
|
|
/// Concatenate two strings |
|
FXAPI FXString operator+(const FXString& s1,const FXString& s2); |
|
FXAPI FXString operator+(const FXString& s1,const FXchar* s2); |
|
FXAPI FXString operator+(const FXchar* s1,const FXString& s2); |
|
|
|
/// Concatenate with single character |
|
FXAPI FXString operator+(const FXString& s,FXchar c); |
|
FXAPI FXString operator+(FXchar c,const FXString& s); |
|
|
|
/// Saving to a stream |
|
FXAPI FXStream& operator<<(FXStream& store,const FXString& s); |
|
|
|
/// Load from a stream |
|
FXAPI FXStream& operator>>(FXStream& store,FXString& s); |
|
|
|
/// Format a string a-la printf |
|
FXAPI FXString FXStringFormat(const FXchar* fmt,...) FX_PRINTF(1,2) ; |
|
FXAPI FXString FXStringVFormat(const FXchar* fmt,va_list args); |
|
|
|
/** |
|
* Convert integer number to a string, using the given number |
|
* base, which must be between 2 and 16. |
|
*/ |
|
FXAPI FXString FXStringVal(FXint num,FXint base=10); |
|
FXAPI FXString FXStringVal(FXuint num,FXint base=10); |
|
|
|
/** |
|
* Convert real number to a string, using the given procision and |
|
* exponential notation mode, which may be FALSE (never), TRUE (always), or |
|
* MAYBE (when needed). |
|
*/ |
|
FXAPI FXString FXStringVal(FXfloat num,FXint prec=6,FXbool exp=MAYBE); |
|
FXAPI FXString FXStringVal(FXdouble num,FXint prec=6,FXbool exp=MAYBE); |
|
|
|
/// Convert string to a integer number, assuming given number base |
|
FXAPI FXint FXIntVal(const FXString& s,FXint base); |
|
FXAPI FXuint FXUIntVal(const FXString& s,FXint base); |
|
|
|
/// Convert string into real number |
|
FXAPI FXfloat FXFloatVal(const FXString& s); |
|
FXAPI FXdouble FXDoubleVal(const FXString& s); |
|
|
|
/// Escape special characters in a string |
|
FXAPI FXString escape(const FXString& s); |
|
|
|
/// Unescape special characters in a string |
|
FXAPI FXString unescape(const FXString& s); |
|
|
|
/// Swap two strings |
|
FXAPI void swap(FXString& a,FXString& b); |
|
|
class FXAPI FXString { | class FXAPI FXString { |
private: | private: |
FXchar* str; | FXchar* str; |
|
|
FXuint hash() const; | FXuint hash() const; |
| |
/// Compare | /// Compare |
friend FXAPI FXint compare(const FXchar* s1,const FXchar* s2); |
|
friend FXAPI FXint compare(const FXchar* s1,const FXString& s2); | friend FXAPI FXint compare(const FXchar* s1,const FXString& s2); |
friend FXAPI FXint compare(const FXString& s1,const FXchar* s2); | friend FXAPI FXint compare(const FXString& s1,const FXchar* s2); |
friend FXAPI FXint compare(const FXString& s1,const FXString& s2); | friend FXAPI FXint compare(const FXString& s1,const FXString& s2); |
| |
/// Compare up to n | /// Compare up to n |
friend FXAPI FXint compare(const FXchar* s1,const FXchar* s2,FXint n); |
|
friend FXAPI FXint compare(const FXchar* s1,const FXString& s2,FXint n); | friend FXAPI FXint compare(const FXchar* s1,const FXString& s2,FXint n); |
friend FXAPI FXint compare(const FXString& s1,const FXchar* s2,FXint n); | friend FXAPI FXint compare(const FXString& s1,const FXchar* s2,FXint n); |
friend FXAPI FXint compare(const FXString& s1,const FXString& s2,FXint n); | friend FXAPI FXint compare(const FXString& s1,const FXString& s2,FXint n); |
| |
/// Compare case insensitive | /// Compare case insensitive |
friend FXAPI FXint comparecase(const FXchar* s1,const FXchar* s2); |
|
friend FXAPI FXint comparecase(const FXchar* s1,const FXString& s2); | friend FXAPI FXint comparecase(const FXchar* s1,const FXString& s2); |
friend FXAPI FXint comparecase(const FXString& s1,const FXchar* s2); | friend FXAPI FXint comparecase(const FXString& s1,const FXchar* s2); |
friend FXAPI FXint comparecase(const FXString& s1,const FXString& s2); | friend FXAPI FXint comparecase(const FXString& s1,const FXString& s2); |
| |
/// Compare case insensitive up to n | /// Compare case insensitive up to n |
friend FXAPI FXint comparecase(const FXchar* s1,const FXchar* s2,FXint n); |
|
friend FXAPI FXint comparecase(const FXchar* s1,const FXString& s2,FXint n); | friend FXAPI FXint comparecase(const FXchar* s1,const FXString& s2,FXint n); |
friend FXAPI FXint comparecase(const FXString& s1,const FXchar* s2,FXint n); | friend FXAPI FXint comparecase(const FXString& s1,const FXchar* s2,FXint n); |
friend FXAPI FXint comparecase(const FXString& s1,const FXString& s2,FXint n); | friend FXAPI FXint comparecase(const FXString& s1,const FXString& s2,FXint n); |
|
|
friend FXAPI FXString FXStringFormat(const FXchar* fmt,...) FX_PRINTF(1,2) ; | friend FXAPI FXString FXStringFormat(const FXchar* fmt,...) FX_PRINTF(1,2) ; |
friend FXAPI FXString FXStringVFormat(const FXchar* fmt,va_list args); | friend FXAPI FXString FXStringVFormat(const FXchar* fmt,va_list args); |
| |
/** |
|
* Convert integer number to a string, using the given number |
|
* base, which must be between 2 and 16. |
|
*/ |
|
friend FXAPI FXString FXStringVal(FXint num,FXint base=10); |
|
friend FXAPI FXString FXStringVal(FXuint num,FXint base=10); |
|
|
|
/** |
|
* Convert real number to a string, using the given procision and |
|
* exponential notation mode, which may be FALSE (never), TRUE (always), or |
|
* MAYBE (when needed). |
|
*/ |
|
friend FXAPI FXString FXStringVal(FXfloat num,FXint prec=6,FXbool exp=MAYBE); |
|
friend FXAPI FXString FXStringVal(FXdouble num,FXint prec=6,FXbool exp=MAYBE); |
|
|
|
/// Convert string to a integer number, assuming given number base | /// Convert string to a integer number, assuming given number base |
friend FXAPI FXint FXIntVal(const FXString& s,FXint base=10); | friend FXAPI FXint FXIntVal(const FXString& s,FXint base=10); |
friend FXAPI FXuint FXUIntVal(const FXString& s,FXint base=10); | friend FXAPI FXuint FXUIntVal(const FXString& s,FXint base=10); |
|
|
friend FXAPI FXfloat FXFloatVal(const FXString& s); | friend FXAPI FXfloat FXFloatVal(const FXString& s); |
friend FXAPI FXdouble FXDoubleVal(const FXString& s); | friend FXAPI FXdouble FXDoubleVal(const FXString& s); |
| |
/// Escape special characters in a string |
|
friend FXAPI FXString escape(const FXString& s); |
|
|
|
/// Unescape special characters in a string |
|
friend FXAPI FXString unescape(const FXString& s); |
|
|
|
/// Swap two strings | /// Swap two strings |
friend FXAPI void swap(FXString& a,FXString& b){ FXchar *t=a.str; a.str=b.str; b.str=t; } | friend FXAPI void swap(FXString& a,FXString& b){ FXchar *t=a.str; a.str=b.str; b.str=t; } |
| |