X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a99bcb5e5ed1ed59ea1975b6262aa602bd490539..4f2511d706e5274a34e1521e11c1b95fed735b42:/include/wx/ustring.h diff --git a/include/wx/ustring.h b/include/wx/ustring.h index 03f3493e87..05cf803879 100644 --- a/include/wx/ustring.h +++ b/include/wx/ustring.h @@ -30,13 +30,13 @@ typedef wxCharTypeBuffer wxU32CharBuffer; class WXDLLIMPEXP_BASE wxUString: public std::basic_string { -public: +public: wxUString() { } - + wxUString( const wxChar32 *str ) { assign(str); } wxUString( const wxUString &str ) { assign(str); } wxUString( const wxU32CharBuffer &buf ) { assign(buf); } - + wxUString( const char *str ) { assign(str); } wxUString( const wxCharBuffer &buf ) { assign(buf); } wxUString( const char *str, const wxMBConv &conv ) { assign(str,conv); } @@ -44,10 +44,10 @@ public: wxUString( const wxChar16 *str ) { assign(str); } wxUString( const wxU16CharBuffer &buf ) { assign(buf); } - + wxUString( const wxCStrData *cstr ) { assign(cstr); } wxUString( const wxString &str ) { assign(str); } - + wxUString( char ch ) { assign(ch); } wxUString( wxChar16 ch ) { assign(ch); } wxUString( wxChar32 ch ) { assign(ch); } @@ -58,53 +58,53 @@ public: wxUString( size_type n, wxChar32 ch ) { assign(n,ch); } wxUString( size_type n, wxUniChar ch ) { assign(n,ch); } wxUString( size_type n, wxUniCharRef ch ) { assign(n,ch); } - + // static construction - + static wxUString FromAscii( const char *str, size_type n ) { wxUString ret; ret.assignFromAscii( str, n ); return ret; } - + static wxUString FromAscii( const char *str ) { wxUString ret; ret.assignFromAscii( str ); return ret; } - + static wxUString FromUTF8( const char *str, size_type n ) { wxUString ret; ret.assignFromUTF8( str, n ); return ret; } - + static wxUString FromUTF8( const char *str ) { wxUString ret; ret.assignFromUTF8( str ); return ret; } - + static wxUString FromUTF16( const wxChar16 *str, size_type n ) { wxUString ret; ret.assignFromUTF16( str, n ); return ret; } - + static wxUString FromUTF16( const wxChar16 *str ) { wxUString ret; ret.assignFromUTF16( str ); return ret; } - + // assign from encoding - + wxUString &assignFromAscii( const char *str ); wxUString &assignFromAscii( const char *str, size_type n ); wxUString &assignFromUTF8( const char *str ); @@ -113,12 +113,12 @@ public: wxUString &assignFromUTF16( const wxChar16* str, size_type n ); wxUString &assignFromCString( const char* str ); wxUString &assignFromCString( const char* str, const wxMBConv &conv ); - + // conversions - + wxCharBuffer utf8_str() const; wxU16CharBuffer utf16_str() const; - + #if SIZEOF_WCHAR_T == 2 wxWCharBuffer wc_str() const { @@ -164,78 +164,78 @@ public: #endif // assign - + inline wxUString &assign( const wxChar32* str ) { std::basic_string *base = this; return (wxUString &) base->assign( str ); } - + inline wxUString &assign( const wxChar32* str, size_type n ) { std::basic_string *base = this; return (wxUString &) base->assign( str, n ); } - + inline wxUString &assign( const wxUString &str ) { std::basic_string *base = this; return (wxUString &) base->assign( str ); } - + inline wxUString &assign( const wxUString &str, size_type pos, size_type n ) { std::basic_string *base = this; return (wxUString &) base->assign( str, pos, n ); } - + inline wxUString &assign( wxChar32 ch ) { std::basic_string *base = this; return (wxUString &) base->assign( (size_type) 1, ch ); } - + inline wxUString &assign( size_type n, wxChar32 ch ) { std::basic_string *base = this; return (wxUString &) base->assign( n, ch ); } - + wxUString &assign( const wxU32CharBuffer &buf ) { return assign( buf.data() ); } - + wxUString &assign( const char *str ) { return assignFromCString( str ); } - + wxUString &assign( const wxCharBuffer &buf ) - { + { return assignFromCString( buf.data() ); } - + wxUString &assign( const char *str, const wxMBConv &conv ) - { + { return assignFromCString( str, conv ); } - + wxUString &assign( const wxCharBuffer &buf, const wxMBConv &conv ) - { + { return assignFromCString( buf.data(), conv ); } - + wxUString &assign( const wxChar16 *str ) { return assignFromUTF16( str ); } - + wxUString &assign( const wxU16CharBuffer &buf ) { return assignFromUTF16( buf.data() ); } - + wxUString &assign( const wxCStrData *cstr ) { #if SIZEOF_WCHAR_T == 2 @@ -244,7 +244,7 @@ public: return assign( cstr->AsWChar() ); #endif } - + wxUString &assign( const wxString &str ) { #if wxUSE_UNICODE_UTF8 @@ -253,11 +253,11 @@ public: #if SIZEOF_WCHAR_T == 2 return assignFromUTF16( str.wc_str() ); #else - return assign( wc_str() ); + return assign( str.wc_str() ); #endif #endif } - + wxUString &assign( char ch ) { char buf[2]; @@ -265,9 +265,9 @@ public: buf[1] = 0; return assignFromCString( buf ); } - + wxUString &assign( size_type n, char ch ) - { + { wxCharBuffer buffer(n); char *p = buffer.data(); size_type i; @@ -278,7 +278,7 @@ public: } return assignFromCString( buffer.data() ); } - + wxUString &assign( wxChar16 ch ) { wxChar16 buf[2]; @@ -286,7 +286,7 @@ public: buf[1] = 0; return assignFromUTF16( buf ); } - + wxUString &assign( size_type n, wxChar16 ch ) { wxU16CharBuffer buffer(n); @@ -299,41 +299,41 @@ public: } return assignFromUTF16( buffer.data() ); } - + wxUString &assign( wxUniChar ch ) { return assign( (const wxChar32) ch.GetValue() ); } - + wxUString &assign( size_type n, wxUniChar ch ) { return assign( n, (const wxChar32) ch.GetValue() ); } - + wxUString &assign( wxUniCharRef ch ) { return assign( (const wxChar32) ch.GetValue() ); } - + wxUString &assign( size_type n, wxUniCharRef ch ) { return assign( n, (const wxChar32) ch.GetValue() ); } - + // append [STL overload] - + inline wxUString &append( const wxUString &s ) { std::basic_string *base = this; return (wxUString &) base->append( s ); } - + inline wxUString &append( const wxUString &s, size_type pos, size_type n ) { std::basic_string *base = this; return (wxUString &) base->append( s, pos, n ); } - + inline wxUString &append( const wxChar32* s ) { std::basic_string *base = this; @@ -384,17 +384,17 @@ public: { return append( wxUString( str ) ); } - + wxUString &append( const wxString &str ) { return append( wxUString( str ) ); } - + wxUString &append( const wxCStrData *cstr ) { return append( wxUString( cstr ) ); } - + wxUString &append( char ch ) { char buf[2]; @@ -402,7 +402,7 @@ public: buf[1] = 0; return append( buf ); } - + wxUString &append( wxChar16 ch ) { wxChar16 buf[2]; @@ -410,7 +410,7 @@ public: buf[1] = 0; return append( buf ); } - + wxUString &append( wxUniChar ch ) { return append( (size_type) 1, (wxChar32) ch.GetValue() ); @@ -421,9 +421,9 @@ public: return append( (size_type) 1, (wxChar32) ch.GetValue() ); } - + // insert [STL overloads] - + inline wxUString &insert( size_type pos, const wxUString &s ) { std::basic_string *base = this; @@ -486,12 +486,12 @@ public: { return insert( n, wxUString( s ) ); } - + wxUString &insert( size_type n, const wxCStrData *cstr ) { return insert( n, wxUString( cstr ) ); } - + wxUString &insert( size_type n, char ch ) { char buf[2]; @@ -499,7 +499,7 @@ public: buf[1] = 0; return insert( n, buf ); } - + wxUString &insert( size_type n, wchar_t ch ) { wchar_t buf[2]; @@ -507,15 +507,15 @@ public: buf[1] = 0; return insert( n, buf ); } - + // insert iterator - + iterator insert( iterator it, wxChar32 ch ) { std::basic_string *base = this; return base->insert( it, ch ); } - + void insert(iterator it, const_iterator first, const_iterator last) { std::basic_string *base = this; @@ -552,7 +552,7 @@ public: { return assign( ch ); } inline wxUString& operator=(const wxUniCharRef ch) { return assign( ch ); } - + // operator += inline wxUString& operator+=(const wxUString& s) { return append( s ); } @@ -582,7 +582,7 @@ public: { return append( ch ); } inline wxUString& operator+=(const wxUniCharRef ch) { return append( ch ); } - + }; inline wxUString operator+(const wxUString &s1, const wxUString &s2)