Improved conversion constructor arrangement to always allow a second
wxMBConv-type argument (changes the signature of the non-Unicode create-from-wchar_t constructor). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@6936 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -321,6 +321,8 @@ public:
|
||||
// (default value of wxSTRING_MAXLEN means take all the string)
|
||||
wxString(const wxChar *psz, size_t nLength = wxSTRING_MAXLEN)
|
||||
{ InitWith(psz, 0, nLength); }
|
||||
wxString(const wxChar *psz, wxMBConv& WXUNUSED(conv), size_t nLength = wxSTRING_MAXLEN)
|
||||
{ InitWith(psz, 0, nLength); }
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
// from multibyte string
|
||||
@@ -334,13 +336,10 @@ public:
|
||||
// from C string (for compilers using unsigned char)
|
||||
wxString(const unsigned char* psz, size_t nLength = wxSTRING_MAXLEN)
|
||||
{ InitWith((const char*)psz, 0, nLength); }
|
||||
// from multibyte string
|
||||
wxString(const char *psz, wxMBConv& WXUNUSED(conv) , size_t nLength = wxSTRING_MAXLEN)
|
||||
{ InitWith(psz, 0, nLength); }
|
||||
|
||||
#if wxUSE_WCHAR_T
|
||||
// from wide (Unicode) string
|
||||
wxString(const wchar_t *pwz);
|
||||
wxString(const wchar_t *pwz, wxMBConv& conv = wxConvLibc);
|
||||
#endif // !wxUSE_WCHAR_T
|
||||
|
||||
// from wxCharBuffer
|
||||
|
@@ -341,15 +341,15 @@ wxString::wxString(const char *psz, wxMBConv& conv, size_t nLength)
|
||||
|
||||
#if wxUSE_WCHAR_T
|
||||
// from wide string
|
||||
wxString::wxString(const wchar_t *pwz)
|
||||
wxString::wxString(const wchar_t *pwz, wxMBConv& conv)
|
||||
{
|
||||
// first get necessary size
|
||||
size_t nLen = pwz ? wxWC2MB((char *) NULL, pwz, 0) : 0;
|
||||
size_t nLen = pwz ? conv.WC2MB((char *) NULL, pwz, 0) : 0;
|
||||
|
||||
// empty?
|
||||
if ( (nLen != 0) && (nLen != (size_t)-1) ) {
|
||||
AllocBuffer(nLen);
|
||||
wxWC2MB(m_pchData, pwz, nLen);
|
||||
conv.WC2MB(m_pchData, pwz, nLen);
|
||||
}
|
||||
else {
|
||||
Init();
|
||||
|
Reference in New Issue
Block a user