const wchar_t* AsWChar() const;
operator const wchar_t*() const { return AsWChar(); }
-#if !wxUSE_UNICODE
+#if !wxUSE_UNICODE || wxUSE_UTF8_LOCALE_ONLY
inline
#endif
const char* AsChar() const;
protected:
wxStringPrintfMixinBase() {}
- int DoPrintf(const wxString& format, ...);
- static wxString DoFormat(const wxString& format, ...);
+#if !wxUSE_UTF8_LOCALE_ONLY
+ int DoPrintfWchar(const wxChar *format, ...);
+ static wxString DoFormatWchar(const wxChar *format, ...);
+#endif
+#if wxUSE_UNICODE_UTF8
+ int DoPrintfUtf8(const char *format, ...);
+ static wxString DoFormatUtf8(const char *format, ...);
+#endif
};
// this class contains template wrappers for wxString's vararg methods, it's
// if !wxNEEDS_WXSTRING_PRINTF_MIXIN:
// static wxString Format(const wString& format, ...) ATTRIBUTE_PRINTF_1;
- WX_DEFINE_VARARG_FUNC2_SANS_N0(static typename StringReturnType<T1>::type,
- Format, 1, (const wxString&),
- DoFormat, DoFormat)
+ WX_DEFINE_VARARG_FUNC_SANS_N0(static typename StringReturnType<T1>::type,
+ Format, 1, (const wxFormatString&),
+ DoFormatWchar, DoFormatUtf8)
// We have to implement the version without template arguments manually
// because of the StringReturnType<> hack, although WX_DEFINE_VARARG_FUNC
// normally does it itself. It has to be a template so that we can use
template<typename T>
inline static typename StringReturnType<T>::type
- Format(const wxString& fmt, FormatDummyArg dummy = FormatDummyArg())
+ Format(const wxFormatString& fmt, FormatDummyArg dummy = FormatDummyArg())
{
- return DoFormat(fmt);
+ return DoFormatWchar(fmt);
}
// int Printf(const wxString& format, ...);
- WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxString&), DoPrintf)
+ WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxFormatString&),
+ DoPrintfWchar, DoPrintfUtf8)
// int sprintf(const wxString& format, ...) ATTRIBUTE_PRINTF_2;
- WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxString&), DoPrintf)
+ WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxFormatString&),
+ DoPrintfWchar, DoPrintfUtf8)
protected:
wxStringPrintfMixin() : wxStringPrintfMixinBase() {}
#else // wxUSE_UNICODE_UTF8
- // FIXME-UTF8: return as-is without copying under UTF8 locale, return
- // converted string under other locales - needs wxCharBuffer
- // changes
static wxCharBuffer ImplStr(const char* str,
const wxMBConv& conv = wxConvLibc)
{ return ConvertStr(str, npos, conv).data; }
{ return wxStdWideString(wc_str()); }
#endif
- #if !wxUSE_UNICODE && wxUSE_STL_BASED_WXSTRING
- // FIXME-UTF8: do this in UTF8 build #if wxUSE_UTF8_LOCALE_ONLY, too
+ #if (!wxUSE_UNICODE || wxUSE_UTF8_LOCALE_ONLY) && wxUSE_STL_BASED_WXSTRING
// wxStringImpl is std::string in the encoding we want
operator const std::string&() const { return m_impl; }
#else
// FIXME-UTF8: broken for embedded NULs
{ return std::string(mb_str()); }
#endif
-
-#endif // wxUSE_STD_STRING
+#endif // wxUSE_STL
// first valid index position
const_iterator begin() const { return const_iterator(m_impl.begin()); }
const char *ToAscii() const { return c_str(); }
#endif // Unicode/!Unicode
+ // conversion to/from UTF-8:
+#if wxUSE_UNICODE_UTF8
+ static wxString FromUTF8(const char *utf8)
+ {
+ wxASSERT( wxStringOperations::IsValidUtf8String(utf8) );
+ return FromImpl(wxStringImpl(utf8));
+ }
+ static wxString FromUTF8(const char *utf8, size_t len)
+ {
+ wxASSERT( wxStringOperations::IsValidUtf8String(utf8, len) );
+ return FromImpl(wxStringImpl(utf8, len));
+ }
+ const char* utf8_str() const { return wx_str(); }
+ const char* ToUTF8() const { return wx_str(); }
+#elif wxUSE_UNICODE_WCHAR
+ static wxString FromUTF8(const char *utf8)
+ { return wxString(utf8, wxConvUTF8); }
+ static wxString FromUTF8(const char *utf8, size_t len)
+ { return wxString(utf8, wxConvUTF8, len); }
+ const wxCharBuffer utf8_str() const { return mb_str(wxConvUTF8); }
+ const wxCharBuffer ToUTF8() const { return utf8_str(); }
+#else // ANSI
+ static wxString FromUTF8(const char *utf8)
+ { return wxString(wxConvUTF8.cMB2WC(utf8)); }
+ static wxString FromUTF8(const char *utf8, size_t len)
+ {
+ size_t wlen;
+ wxWCharBuffer buf(wxConvUTF8.cMB2WC(utf8, len == npos ? wxNO_LEN : len, &wlen));
+ return wxString(buf.data(), wlen);
+ }
+ const wxCharBuffer utf8_str() const { return wxConvUTF8.cWC2MB(wc_str()); }
+ const wxCharBuffer ToUTF8() const { return utf8_str(); }
+#endif
+
// functions for storing binary data in wxString:
#if wxUSE_UNICODE
static wxString From8BitData(const char *data, size_t len)
// type differs because a function may either return pointer to the buffer
// directly or have to use intermediate buffer for translation.
#if wxUSE_UNICODE
+
+#if wxUSE_UTF8_LOCALE_ONLY
+ const char* mb_str() const { return wx_str(); }
+ const wxCharBuffer mb_str(const wxMBConv& conv) const;
+#else
const wxCharBuffer mb_str(const wxMBConv& conv = wxConvLibc) const;
+#endif
const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); }
// string += buffer (i.e. from wxGetString)
wxString& operator<<(const wxWCharBuffer& s)
{ return operator<<((const wchar_t *)s); }
- wxString& operator+=(const wxWCharBuffer& s)
- { return operator<<((const wchar_t *)s); }
-
wxString& operator<<(const wxCharBuffer& s)
{ return operator<<((const char *)s); }
- wxString& operator+=(const wxCharBuffer& s)
- { return operator<<((const char *)s); }
// string += C string
wxString& Append(const wxString& s)
append(s);
return *this;
}
- wxString& Append(const wxCStrData& psz)
- { append(psz); return *this; }
wxString& Append(const char* psz)
{ append(psz); return *this; }
wxString& Append(const wchar_t* pwz)
{ append(pwz); return *this; }
+ wxString& Append(const wxCStrData& psz)
+ { append(psz); return *this; }
+ wxString& Append(const wxCharBuffer& psz)
+ { append(psz); return *this; }
+ wxString& Append(const wxWCharBuffer& psz)
+ { append(psz); return *this; }
// append count copies of given character
wxString& Append(wxUniChar ch, size_t count = 1u)
{ append(count, ch); return *this; }
{ return compare(pwz); }
int Cmp(const wxString& s) const
{ return compare(s); }
+ int Cmp(const wxCStrData& s) const
+ { return compare(s); }
+ int Cmp(const wxCharBuffer& s) const
+ { return compare(s); }
+ int Cmp(const wxWCharBuffer& s) const
+ { return compare(s); }
// same as Cmp() but not case-sensitive
int CmpNoCase(const wxString& s) const;
- int CmpNoCase(const char *psz) const
- { return CmpNoCase(wxString(psz)); }
- int CmpNoCase(const wchar_t *pwz) const
- { return CmpNoCase(wxString(pwz)); }
// test for the string equality, either considering case or not
// (if compareWithCase then the case matters)
bool IsSameAs(const wxString& str, bool compareWithCase = true) const
{ return (compareWithCase ? Cmp(str) : CmpNoCase(str)) == 0; }
bool IsSameAs(const wchar_t *str, bool compareWithCase = true) const
{ return (compareWithCase ? Cmp(str) : CmpNoCase(str)) == 0; }
+ bool IsSameAs(const wxCStrData& str, bool compareWithCase = true) const
+ { return IsSameAs(str.AsString(), compareWithCase); }
+ bool IsSameAs(const wxCharBuffer& str, bool compareWithCase = true) const
+ { return IsSameAs(str.data(), compareWithCase); }
+ bool IsSameAs(const wxWCharBuffer& str, bool compareWithCase = true) const
+ { return IsSameAs(str.data(), compareWithCase); }
// comparison with a single character: returns true if equal
bool IsSameAs(wxUniChar c, bool compareWithCase = true) const
{
int Find(wchar_t ch, bool bFromEnd = false) const
{ return Find(wxUniChar(ch), bFromEnd); }
// searching (return starting index, or -1 if not found)
- // FIXME-UTF8: keep wxString overload only
int Find(const wxString& sub) const // like strstr
{
size_type idx = find(sub);
return (idx == npos) ? wxNOT_FOUND : (int)idx;
}
+ int Find(const wxCStrData& sub) const
+ { return Find(sub.AsString()); }
+ int Find(const wxCharBuffer& sub) const
+ { return Find(sub.data()); }
+ int Find(const wxWCharBuffer& sub) const
+ { return Find(sub.data()); }
+
// replace first (or all of bReplaceAll) occurences of substring with
// another string, returns the number of replacements made
size_t Replace(const wxString& strOld,
// as sprintf(), returns the number of characters written or < 0 on error
// (take 'this' into account in attribute parameter count)
// int Printf(const wxString& format, ...);
- WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxString&), DoPrintf)
+ WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxFormatString&),
+ DoPrintfWchar, DoPrintfUtf8)
#ifdef __WATCOMC__
- WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const char*), DoPrintf)
- WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wchar_t*), DoPrintf)
- WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxCStrData&), DoPrintf)
+ // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
+ WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const wxString&),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const wxCStrData&),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const char*),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const wchar_t*),
+ (wxFormatString(f1)));
#endif
#endif // !wxNEEDS_WXSTRING_PRINTF_MIXIN
// as vprintf(), returns the number of characters written or < 0 on error
#ifndef wxNEEDS_WXSTRING_PRINTF_MIXIN
// returns the string containing the result of Printf() to it
// static wxString Format(const wxString& format, ...) ATTRIBUTE_PRINTF_1;
- WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const wxString&), DoFormat)
+ WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const wxFormatString&),
+ DoFormatWchar, DoFormatUtf8)
#ifdef __WATCOMC__
// workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
- WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const char*), DoFormat)
- WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const wchar_t*), DoFormat)
- WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const wxCStrData&), DoFormat)
+ WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const wxString&),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const wxCStrData&),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const char*),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const wchar_t*),
+ (wxFormatString(f1)));
#endif
#endif
// the same as above, but takes a va_list
// use Printf()
// (take 'this' into account in attribute parameter count)
// int sprintf(const wxString& format, ...) ATTRIBUTE_PRINTF_2;
- WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxString&), DoPrintf)
+ WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxFormatString&),
+ DoPrintfWchar, DoPrintfUtf8)
#ifdef __WATCOMC__
// workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
- WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const char*), DoPrintf)
- WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wchar_t*), DoPrintf)
- WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxCStrData&), DoPrintf)
+ WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const wxString&),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const wxCStrData&),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const char*),
+ (wxFormatString(f1)));
+ WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const wchar_t*),
+ (wxFormatString(f1)));
#endif
#endif // wxNEEDS_WXSTRING_PRINTF_MIXIN
int First( char ch ) const { return Find(ch); }
int First( unsigned char ch ) const { return Find(ch); }
int First( wchar_t ch ) const { return Find(ch); }
- int First( const wxChar* psz ) const { return Find(psz); }
int First( const wxString& str ) const { return Find(str); }
int Last( wxUniChar ch ) const { return Find(ch, true); }
bool Contains(const wxString& str) const { return Find(str) != wxNOT_FOUND; }
// append a string
wxString& append(const wxString& str)
{ m_impl.append(str.m_impl); return *this; }
- wxString& append(const wxCStrData& str)
- { m_impl.append(str.AsString().m_impl); return *this; }
// append first n (or all if n == npos) characters of sz
wxString& append(const char *sz)
{ m_impl.append(ImplStr(sz)); return *this; }
m_impl.append(str.data, str.len);
return *this;
}
+
+ wxString& append(const wxCStrData& str)
+ { return append(str.AsString()); }
+ wxString& append(const wxCharBuffer& str)
+ { return append(str.data()); }
+ wxString& append(const wxWCharBuffer& str)
+ { return append(str.data()); }
+
// append n copies of ch
wxString& append(size_t n, wxUniChar ch)
{
m_impl.assign(str.data, str.len);
return *this;
}
+
+ wxString& assign(const wxCStrData& str)
+ { return assign(str.AsString()); }
+ wxString& assign(const wxCharBuffer& str)
+ { return assign(str.data()); }
+ wxString& assign(const wxWCharBuffer& str)
+ { return assign(str.data()); }
+ wxString& assign(const wxCStrData& str, size_t len)
+ { return assign(str.AsString(), len); }
+ wxString& assign(const wxCharBuffer& str, size_t len)
+ { return assign(str.data(), len); }
+ wxString& assign(const wxWCharBuffer& str, size_t len)
+ { return assign(str.data(), len); }
+
// same as `= n copies of ch'
wxString& assign(size_t n, wxUniChar ch)
{
// string comparison
int compare(const wxString& str) const;
+ int compare(const char* sz) const;
+ int compare(const wchar_t* sz) const;
+ int compare(const wxCStrData& str) const
+ { return compare(str.AsString()); }
+ int compare(const wxCharBuffer& str) const
+ { return compare(str.data()); }
+ int compare(const wxWCharBuffer& str) const
+ { return compare(str.data()); }
// comparison with a substring
int compare(size_t nStart, size_t nLen, const wxString& str) const;
// comparison of 2 substrings
int compare(size_t nStart, size_t nLen,
const wxString& str, size_t nStart2, size_t nLen2) const;
- // just like strcmp()
- int compare(const char* sz) const;
- int compare(const wchar_t* sz) const;
// substring comparison with first nCount characters of sz
int compare(size_t nStart, size_t nLen,
const char* sz, size_t nCount = npos) const;
SubstrBufFromWC str(ImplStr(sz, n));
return PosFromImpl(m_impl.find(str.data, PosToImpl(nStart), str.len));
}
+ size_t find(const wxCharBuffer& s, size_t nStart = 0, size_t n = npos) const
+ { return find(s.data(), nStart, n); }
+ size_t find(const wxWCharBuffer& s, size_t nStart = 0, size_t n = npos) const
+ { return find(s.data(), nStart, n); }
+ size_t find(const wxCStrData& s, size_t nStart = 0, size_t n = npos) const
+ { return find(s.AsWChar(), nStart, n); }
// find the first occurence of character ch after nStart
size_t find(wxUniChar ch, size_t nStart = 0) const
SubstrBufFromWC str(ImplStr(sz, n));
return PosFromImpl(m_impl.rfind(str.data, PosToImpl(nStart), str.len));
}
+ size_t rfind(const wxCharBuffer& s, size_t nStart = npos, size_t n = npos) const
+ { return rfind(s.data(), nStart, n); }
+ size_t rfind(const wxWCharBuffer& s, size_t nStart = npos, size_t n = npos) const
+ { return rfind(s.data(), nStart, n); }
+ size_t rfind(const wxCStrData& s, size_t nStart = npos, size_t n = npos) const
+ { return rfind(s.AsWChar(), nStart, n); }
// as find, but from the end
size_t rfind(wxUniChar ch, size_t nStart = npos) const
{
// as strpbrk() but starts at nStart, returns npos if not found
size_t find_first_of(const wxString& str, size_t nStart = 0) const
#if wxUSE_UNICODE // FIXME-UTF8: temporary
- { return find_first_of(str.mb_str().data(), nStart); }
+ { return find_first_of(str.wc_str(), nStart); }
#else
- { return find_first_of((const wxChar*)str.c_str(), nStart); }
+ { return find_first_of(str.mb_str(), nStart); }
#endif
// same as above
size_t find_first_of(const char* sz, size_t nStart = 0) const;
// find the last (starting from nStart) char from str in this string
size_t find_last_of (const wxString& str, size_t nStart = npos) const
#if wxUSE_UNICODE // FIXME-UTF8: temporary
- { return find_last_of(str.mb_str().data(), nStart); }
+ { return find_last_of(str.wc_str(), nStart); }
#else
- { return find_last_of((const wxChar*)str.c_str(), nStart); }
+ { return find_last_of(str.mb_str(), nStart); }
#endif
// same as above
size_t find_last_of (const char* sz, size_t nStart = npos) const;
// as strspn() (starting from nStart), returns npos on failure
size_t find_first_not_of(const wxString& str, size_t nStart = 0) const
#if wxUSE_UNICODE // FIXME-UTF8: temporary
- { return find_first_not_of(str.mb_str().data(), nStart); }
+ { return find_first_not_of(str.wc_str(), nStart); }
#else
- { return find_first_not_of((const wxChar*)str.c_str(), nStart); }
+ { return find_first_not_of(str.mb_str(), nStart); }
#endif
// same as above
size_t find_first_not_of(const char* sz, size_t nStart = 0) const;
// as strcspn()
size_t find_last_not_of(const wxString& str, size_t nStart = npos) const
#if wxUSE_UNICODE // FIXME-UTF8: temporary
- { return find_last_not_of(str.mb_str().data(), nStart); }
+ { return find_last_not_of(str.wc_str(), nStart); }
#else
- { return find_last_not_of((const wxChar*)str.c_str(), nStart); }
+ { return find_last_not_of(str.mb_str(), nStart); }
#endif
// same as above
size_t find_last_not_of(const char* sz, size_t nStart = npos) const;
size_t find_last_not_of(wchar_t ch, size_t nStart = npos) const
{ return find_last_not_of(wxUniChar(ch), nStart); }
+ // and additional overloads for the versions taking strings:
+ size_t find_first_of(const wxCStrData& sz, size_t nStart = 0) const
+ { return find_first_of(sz.AsString(), nStart); }
+ size_t find_first_of(const wxCharBuffer& sz, size_t nStart = 0) const
+ { return find_first_of(sz.data(), nStart); }
+ size_t find_first_of(const wxWCharBuffer& sz, size_t nStart = 0) const
+ { return find_first_of(sz.data(), nStart); }
+ size_t find_first_of(const wxCStrData& sz, size_t nStart, size_t n) const
+ { return find_first_of(sz.AsWChar(), nStart, n); }
+ size_t find_first_of(const wxCharBuffer& sz, size_t nStart, size_t n) const
+ { return find_first_of(sz.data(), nStart, n); }
+ size_t find_first_of(const wxWCharBuffer& sz, size_t nStart, size_t n) const
+ { return find_first_of(sz.data(), nStart, n); }
+
+ size_t find_last_of(const wxCStrData& sz, size_t nStart = 0) const
+ { return find_last_of(sz.AsString(), nStart); }
+ size_t find_last_of(const wxCharBuffer& sz, size_t nStart = 0) const
+ { return find_last_of(sz.data(), nStart); }
+ size_t find_last_of(const wxWCharBuffer& sz, size_t nStart = 0) const
+ { return find_last_of(sz.data(), nStart); }
+ size_t find_last_of(const wxCStrData& sz, size_t nStart, size_t n) const
+ { return find_last_of(sz.AsWChar(), nStart, n); }
+ size_t find_last_of(const wxCharBuffer& sz, size_t nStart, size_t n) const
+ { return find_last_of(sz.data(), nStart, n); }
+ size_t find_last_of(const wxWCharBuffer& sz, size_t nStart, size_t n) const
+ { return find_last_of(sz.data(), nStart, n); }
+
+ size_t find_first_not_of(const wxCStrData& sz, size_t nStart = 0) const
+ { return find_first_not_of(sz.AsString(), nStart); }
+ size_t find_first_not_of(const wxCharBuffer& sz, size_t nStart = 0) const
+ { return find_first_not_of(sz.data(), nStart); }
+ size_t find_first_not_of(const wxWCharBuffer& sz, size_t nStart = 0) const
+ { return find_first_not_of(sz.data(), nStart); }
+ size_t find_first_not_of(const wxCStrData& sz, size_t nStart, size_t n) const
+ { return find_first_not_of(sz.AsWChar(), nStart, n); }
+ size_t find_first_not_of(const wxCharBuffer& sz, size_t nStart, size_t n) const
+ { return find_first_not_of(sz.data(), nStart, n); }
+ size_t find_first_not_of(const wxWCharBuffer& sz, size_t nStart, size_t n) const
+ { return find_first_not_of(sz.data(), nStart, n); }
+
+ size_t find_last_not_of(const wxCStrData& sz, size_t nStart = 0) const
+ { return find_last_not_of(sz.AsString(), nStart); }
+ size_t find_last_not_of(const wxCharBuffer& sz, size_t nStart = 0) const
+ { return find_last_not_of(sz.data(), nStart); }
+ size_t find_last_not_of(const wxWCharBuffer& sz, size_t nStart = 0) const
+ { return find_last_not_of(sz.data(), nStart); }
+ size_t find_last_not_of(const wxCStrData& sz, size_t nStart, size_t n) const
+ { return find_last_not_of(sz.AsWChar(), nStart, n); }
+ size_t find_last_not_of(const wxCharBuffer& sz, size_t nStart, size_t n) const
+ { return find_last_not_of(sz.data(), nStart, n); }
+ size_t find_last_not_of(const wxWCharBuffer& sz, size_t nStart, size_t n) const
+ { return find_last_not_of(sz.data(), nStart, n); }
+
// string += string
wxString& operator+=(const wxString& s)
{ m_impl += s.m_impl; return *this; }
{ m_impl += ImplStr(pwz); return *this; }
wxString& operator+=(const wxCStrData& s)
{ m_impl += s.AsString().m_impl; return *this; }
+ wxString& operator+=(const wxCharBuffer& s)
+ { return operator+=(s.data()); }
+ wxString& operator+=(const wxWCharBuffer& s)
+ { return operator+=(s.data()); }
// string += char
wxString& operator+=(wxUniChar ch)
{ m_impl += wxStringOperations::EncodeChar(ch); return *this; }
#endif // !wxUSE_STL_BASED_WXSTRING
#ifndef wxNEEDS_WXSTRING_PRINTF_MIXIN
- int DoPrintf(const wxString& format, ...);
- static wxString DoFormat(const wxString& format, ...);
+ #if !wxUSE_UTF8_LOCALE_ONLY
+ int DoPrintfWchar(const wxChar *format, ...);
+ static wxString DoFormatWchar(const wxChar *format, ...);
+ #endif
+ #if wxUSE_UNICODE_UTF8
+ int DoPrintfUtf8(const char *format, ...);
+ static wxString DoFormatUtf8(const char *format, ...);
+ #endif
#endif
#if !wxUSE_STL_BASED_WXSTRING
T *m_buf;
};
-#if wxUSE_UNICODE
+#if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
ConvertedBuffer<char> m_convertedToChar;
#endif
#if !wxUSE_UNICODE_WCHAR
}
#endif // wxUSE_UNICODE_WCHAR
-#if !wxUSE_UNICODE
+#if !wxUSE_UNICODE || wxUSE_UTF8_LOCALE_ONLY
inline const char* wxCStrData::AsChar() const
{
- return m_str->wx_str() + m_offset;
+ return wxStringOperations::AddToIter(m_str->wx_str(), m_offset);
}
#endif // !wxUSE_UNICODE