Preparing wxString for UTF-8 representation:
1) split into wxStringImpl class that has std::string-like API and operates on char* or wchar_t* data and wxString class that provides Unicode iterators and indexes 2) added both char* and wchar_t* versions of many wxString methods to avoid having to use _T() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45078 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
d9485f89b8
commit
8f93a29f8e
@ -183,6 +183,31 @@
|
||||
#endif /* __WCHAR_TYPE__ */
|
||||
#endif /* ASCII/Unicode */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* define wxStringCharType */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* depending on the platform, Unicode build can either store wxStrings as
|
||||
wchar_t* or UTF-8 encoded char*: */
|
||||
#if wxUSE_UNICODE
|
||||
/* for now, all Unicode builds are wchar_t* based: */
|
||||
#define wxUSE_UNICODE_WCHAR 1
|
||||
#define wxUSE_UNICODE_UTF8 0
|
||||
#else
|
||||
#define wxUSE_UNICODE_WCHAR 0
|
||||
#define wxUSE_UNICODE_UTF8 0
|
||||
#endif
|
||||
|
||||
/* define char type used by wxString internal representation: */
|
||||
#if wxUSE_UNICODE_UTF8
|
||||
typedef char wxStringCharType;
|
||||
#elif wxUSE_UNICODE_WCHAR
|
||||
typedef wchar_t wxStringCharType;
|
||||
#else
|
||||
typedef char wxStringCharType;
|
||||
#endif
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* define _T() and related macros */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
1492
include/wx/string.h
1492
include/wx/string.h
File diff suppressed because it is too large
Load Diff
@ -89,27 +89,11 @@ struct wxArgNormalizer
|
||||
|
||||
// special cases for converting strings:
|
||||
|
||||
// FIXME-UTF8: move this to chartype.h!
|
||||
#if wxUSE_UNICODE
|
||||
/* for now, all Unicode builds are wchar_t* based: */
|
||||
#define wxUSE_UNICODE_WCHAR 1
|
||||
#else
|
||||
#define wxUSE_UNICODE_WCHAR 0
|
||||
#endif
|
||||
|
||||
// FIXME-UTF8: include wx/chartype.h and use wxChar after headers split
|
||||
// FIXME-UTF8: this will be char* in UTF-8 build and wchar_t* on Windows
|
||||
#if wxUSE_UNICODE_WCHAR
|
||||
typedef wchar_t wxArgNativeCharType;
|
||||
#else
|
||||
typedef char wxArgNativeCharType;
|
||||
#endif
|
||||
|
||||
template<>
|
||||
struct WXDLLIMPEXP_BASE wxArgNormalizer<const wxCStrData&>
|
||||
{
|
||||
wxArgNormalizer(const wxCStrData& value) : m_value(value) {}
|
||||
const wxArgNativeCharType *get() const;
|
||||
const wxStringCharType *get() const;
|
||||
|
||||
const wxCStrData& m_value;
|
||||
};
|
||||
@ -125,7 +109,7 @@ template<>
|
||||
struct WXDLLIMPEXP_BASE wxArgNormalizer<const wxString&>
|
||||
{
|
||||
wxArgNormalizer(const wxString& value) : m_value(value) {}
|
||||
const wxArgNativeCharType *get() const;
|
||||
const wxStringCharType *get() const;
|
||||
|
||||
const wxString& m_value;
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -32,14 +32,14 @@
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
const wxArgNativeCharType *wxArgNormalizer<const wxCStrData&>::get() const
|
||||
const wxStringCharType *wxArgNormalizer<const wxCStrData&>::get() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
|
||||
const wxArgNativeCharType *wxArgNormalizer<const wxString&>::get() const
|
||||
const wxStringCharType *wxArgNormalizer<const wxString&>::get() const
|
||||
{
|
||||
return m_value.c_str();
|
||||
return m_value.wx_str();
|
||||
}
|
||||
|
||||
#if wxUSE_UNICODE_WCHAR
|
||||
|
Loading…
Reference in New Issue
Block a user