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:
Ove Kaaven
2000-03-25 22:56:20 +00:00
parent c6f724133d
commit 8fac236758
2 changed files with 6 additions and 7 deletions

View File

@@ -321,6 +321,8 @@ public:
// (default value of wxSTRING_MAXLEN means take all the string) // (default value of wxSTRING_MAXLEN means take all the string)
wxString(const wxChar *psz, size_t nLength = wxSTRING_MAXLEN) wxString(const wxChar *psz, size_t nLength = wxSTRING_MAXLEN)
{ InitWith(psz, 0, nLength); } { InitWith(psz, 0, nLength); }
wxString(const wxChar *psz, wxMBConv& WXUNUSED(conv), size_t nLength = wxSTRING_MAXLEN)
{ InitWith(psz, 0, nLength); }
#if wxUSE_UNICODE #if wxUSE_UNICODE
// from multibyte string // from multibyte string
@@ -334,13 +336,10 @@ public:
// from C string (for compilers using unsigned char) // from C string (for compilers using unsigned char)
wxString(const unsigned char* psz, size_t nLength = wxSTRING_MAXLEN) wxString(const unsigned char* psz, size_t nLength = wxSTRING_MAXLEN)
{ InitWith((const char*)psz, 0, nLength); } { 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 #if wxUSE_WCHAR_T
// from wide (Unicode) string // from wide (Unicode) string
wxString(const wchar_t *pwz); wxString(const wchar_t *pwz, wxMBConv& conv = wxConvLibc);
#endif // !wxUSE_WCHAR_T #endif // !wxUSE_WCHAR_T
// from wxCharBuffer // from wxCharBuffer

View File

@@ -341,15 +341,15 @@ wxString::wxString(const char *psz, wxMBConv& conv, size_t nLength)
#if wxUSE_WCHAR_T #if wxUSE_WCHAR_T
// from wide string // from wide string
wxString::wxString(const wchar_t *pwz) wxString::wxString(const wchar_t *pwz, wxMBConv& conv)
{ {
// first get necessary size // 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? // empty?
if ( (nLen != 0) && (nLen != (size_t)-1) ) { if ( (nLen != 0) && (nLen != (size_t)-1) ) {
AllocBuffer(nLen); AllocBuffer(nLen);
wxWC2MB(m_pchData, pwz, nLen); conv.WC2MB(m_pchData, pwz, nLen);
} }
else { else {
Init(); Init();