added wxMBConv::Clone() to be able to copy conversion objects polymorphically
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38576 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
wxDataInputStream::wxDataInputStream(wxInputStream& s, const wxMBConv& conv)
|
||||
: m_input(&s), m_be_order(false), m_conv(conv)
|
||||
: m_input(&s), m_be_order(false), m_conv(conv.Clone())
|
||||
#else
|
||||
wxDataInputStream::wxDataInputStream(wxInputStream& s)
|
||||
: m_input(&s), m_be_order(false)
|
||||
@@ -35,6 +35,13 @@ wxDataInputStream::wxDataInputStream(wxInputStream& s)
|
||||
{
|
||||
}
|
||||
|
||||
wxDataInputStream::~wxDataInputStream()
|
||||
{
|
||||
#if wxUSE_UNICODE
|
||||
delete m_conv;
|
||||
#endif // wxUSE_UNICODE
|
||||
}
|
||||
|
||||
#if wxHAS_INT64
|
||||
wxUint64 wxDataInputStream::Read64()
|
||||
{
|
||||
@@ -100,7 +107,7 @@ wxString wxDataInputStream::ReadString()
|
||||
wxCharBuffer tmp(len + 1);
|
||||
m_input->Read(tmp.data(), len);
|
||||
tmp.data()[len] = '\0';
|
||||
wxString ret(m_conv.cMB2WX(tmp.data()));
|
||||
wxString ret(m_conv->cMB2WX(tmp.data()));
|
||||
#else
|
||||
wxString ret;
|
||||
m_input->Read( wxStringBuffer(ret, len), len);
|
||||
@@ -446,7 +453,7 @@ wxDataInputStream& wxDataInputStream::operator>>(float& f)
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
wxDataOutputStream::wxDataOutputStream(wxOutputStream& s, const wxMBConv& conv)
|
||||
: m_output(&s), m_be_order(false), m_conv(conv)
|
||||
: m_output(&s), m_be_order(false), m_conv(conv.Clone())
|
||||
#else
|
||||
wxDataOutputStream::wxDataOutputStream(wxOutputStream& s)
|
||||
: m_output(&s), m_be_order(false)
|
||||
@@ -454,6 +461,13 @@ wxDataOutputStream::wxDataOutputStream(wxOutputStream& s)
|
||||
{
|
||||
}
|
||||
|
||||
wxDataOutputStream::~wxDataOutputStream()
|
||||
{
|
||||
#if wxUSE_UNICODE
|
||||
delete m_conv;
|
||||
#endif // wxUSE_UNICODE
|
||||
}
|
||||
|
||||
#if wxHAS_INT64
|
||||
void wxDataOutputStream::Write64(wxUint64 i)
|
||||
{
|
||||
@@ -497,7 +511,7 @@ void wxDataOutputStream::Write8(wxUint8 i)
|
||||
void wxDataOutputStream::WriteString(const wxString& string)
|
||||
{
|
||||
#if wxUSE_UNICODE
|
||||
const wxWX2MBbuf buf = string.mb_str(m_conv);
|
||||
const wxWX2MBbuf buf = string.mb_str(*m_conv);
|
||||
#else
|
||||
const wxWX2MBbuf buf = string.mb_str();
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user