1. changed all "wxMBConv& conv" parameters to "const wxMBConv&"
2. this allows to use wxConvAuto() instead of wxConvUTF8 as default value for this parameter in the classes which read text from the file: wxConvAuto automatically recognizes the BOM at the start of file and uses the correct conversion 3. don't use Windows for UTF-7 conversions as there is no way to make it fail on invalid UTF-7 strings; use our own wxMBConvUtf7 instead git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38570 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#define _WX_TXTSTREAM_H_
|
||||
|
||||
#include "wx/stream.h"
|
||||
#include "wx/convauto.h"
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
|
||||
@@ -36,9 +37,11 @@ class WXDLLIMPEXP_BASE wxTextInputStream
|
||||
{
|
||||
public:
|
||||
#if wxUSE_UNICODE
|
||||
wxTextInputStream(wxInputStream& s, const wxString &sep=wxT(" \t"), wxMBConv& conv = wxConvUTF8 );
|
||||
wxTextInputStream(wxInputStream& s,
|
||||
const wxString &sep=wxT(" \t"),
|
||||
const wxMBConv& conv = wxConvAuto());
|
||||
#else
|
||||
wxTextInputStream(wxInputStream& s, const wxString &sep=wxT(" \t") );
|
||||
wxTextInputStream(wxInputStream& s, const wxString &sep=wxT(" \t"));
|
||||
#endif
|
||||
~wxTextInputStream();
|
||||
|
||||
@@ -78,7 +81,7 @@ protected:
|
||||
char m_lastBytes[10]; // stores the bytes that were read for the last character
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
wxMBConv &m_conv;
|
||||
wxMBConv m_conv;
|
||||
#endif
|
||||
|
||||
bool EatEOL(const wxChar &c);
|
||||
@@ -102,9 +105,11 @@ class WXDLLIMPEXP_BASE wxTextOutputStream
|
||||
{
|
||||
public:
|
||||
#if wxUSE_UNICODE
|
||||
wxTextOutputStream( wxOutputStream& s, wxEOL mode = wxEOL_NATIVE, wxMBConv& conv = wxConvUTF8 );
|
||||
wxTextOutputStream(wxOutputStream& s,
|
||||
wxEOL mode = wxEOL_NATIVE,
|
||||
const wxMBConv& conv = wxConvAuto());
|
||||
#else
|
||||
wxTextOutputStream( wxOutputStream& s, wxEOL mode = wxEOL_NATIVE );
|
||||
wxTextOutputStream(wxOutputStream& s, wxEOL mode = wxEOL_NATIVE);
|
||||
#endif
|
||||
virtual ~wxTextOutputStream();
|
||||
|
||||
@@ -139,7 +144,7 @@ protected:
|
||||
wxEOL m_mode;
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
wxMBConv &m_conv;
|
||||
wxMBConv m_conv;
|
||||
#endif
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxTextOutputStream)
|
||||
|
Reference in New Issue
Block a user