don't use global wxConvUTF8 object internally, it may be unavailable at static objects destruction time
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45973
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
16 files changed:
\param{const wxString\& }{localFilename = wxEmptyString},
\param{const wxString\& }{globalFilename = wxEmptyString},
\param{long}{ style = 0},
\param{const wxString\& }{localFilename = wxEmptyString},
\param{const wxString\& }{globalFilename = wxEmptyString},
\param{long}{ style = 0},
- \param{wxMBConv\&}{ conv = wxConvUTF8}}
+ \param{const wxMBConv\&}{ conv = wxConvAuto()}}
This is the default and only constructor of the wxConfigBase class, and
derived classes.
This is the default and only constructor of the wxConfigBase class, and
derived classes.
\func{}{wxDataInputStream}{\param{wxInputStream\&}{ stream}}
\func{}{wxDataInputStream}{\param{wxInputStream\&}{ stream}}
-\func{}{wxDataInputStream}{\param{wxInputStream\&}{ stream}, \param{wxMBConv\&}{ conv = wxMBConvUTF8}}
+\func{}{wxDataInputStream}{\param{wxInputStream\&}{ stream}, \param{const wxMBConv\&}{ conv = wxConvAuto()}}
Constructs a datastream object from an input stream. Only read methods will
be available. The second form is only available in Unicode build of wxWidgets.
Constructs a datastream object from an input stream. Only read methods will
be available. The second form is only available in Unicode build of wxWidgets.
\func{}{wxDataOutputStream}{\param{wxOutputStream\&}{ stream}}
\func{}{wxDataOutputStream}{\param{wxOutputStream\&}{ stream}}
-\func{}{wxDataOutputStream}{\param{wxOutputStream\&}{ stream}, \param{wxMBConv\&}{ conv = wxMBConvUTF8}}
+\func{}{wxDataOutputStream}{\param{wxOutputStream\&}{ stream}, \param{const wxMBConv\&}{ conv = wxConvAuto(){}
Constructs a datastream object from an output stream. Only write methods will
be available. The second form is only available in Unicode build of wxWidgets.
Constructs a datastream object from an output stream. Only write methods will
be available. The second form is only available in Unicode build of wxWidgets.
\membersection{wxFFile::ReadAll}\label{wxffilereadall}
\membersection{wxFFile::ReadAll}\label{wxffilereadall}
-\func{bool}{ReadAll}{\param{wxString *}{ str}, \param{wxMBConv\&}{ conv = wxConvUTF8}}
+\func{bool}{ReadAll}{\param{wxString *}{ str}, \param{const wxMBConv\&}{ conv = wxConvAuto()}}
Reads the entire contents of the file into a string.
Reads the entire contents of the file into a string.
\membersection{wxFFile::Write}\label{wxffilewrites}
\membersection{wxFFile::Write}\label{wxffilewrites}
-\func{bool}{Write}{\param{const wxString\& }{s}, \param{wxMBConv\&}{ conv = wxConvUTF8}}
+\func{bool}{Write}{\param{const wxString\& }{s}, \param{const wxMBConv\&}{ conv = wxConvAuto()}}
Writes the contents of the string to the file, returns \true on success.
Writes the contents of the string to the file, returns \true on success.
\membersection{wxFile::Write}\label{wxfilewrites}
\membersection{wxFile::Write}\label{wxfilewrites}
-\func{bool}{Write}{\param{const wxString\& }{s}, \param{wxMBConv\&}{ conv = wxConvUTF8}}
+\func{bool}{Write}{\param{const wxString\& }{s}, \param{const wxMBConv\&}{ conv = wxConvUTF8}}
Writes the contents of the string to the file, returns true on success.
Writes the contents of the string to the file, returns true on success.
\membersection{wxFileConfig::wxFileConfig}\label{wxfileconfigctor}
\membersection{wxFileConfig::wxFileConfig}\label{wxfileconfigctor}
-\func{}{wxFileConfig}{\param{wxInputStream\& }{is}, \param{wxMBConv\& }{conv = wxConvUTF8}}
+\func{}{wxFileConfig}{\param{wxInputStream\& }{is}, \param{const wxMBConv\& }{conv = wxConvAuto()}}
Read the config data from the specified stream instead of the associated file,
as usual.
Read the config data from the specified stream instead of the associated file,
as usual.
\membersection{wxFileConfig::Save}\label{wxfileconfigsave}
\membersection{wxFileConfig::Save}\label{wxfileconfigsave}
-\func{bool}{Save}{\param{wxOutputStream\& }{os}, \param{wxMBConv\& }{conv = wxConvUTF8}}
+\func{bool}{Save}{\param{wxOutputStream\& }{os}, \param{const wxMBConv\& }{conv = wxConvAuto()}}
Saves all config data to the given stream, returns \true if data was saved
successfully or \false on error.
Saves all config data to the given stream, returns \true if data was saved
successfully or \false on error.
\membersection{wxTempFile::Write}\label{wxtempfilewrites}
\membersection{wxTempFile::Write}\label{wxtempfilewrites}
-\func{bool}{Write}{\param{const wxString\& }{str}, \param{wxMBConv\&}{ conv = wxConvLibc}}
+\func{bool}{Write}{\param{const wxString\& }{str}, \param{const wxMBConv\&}{ conv = wxConvUTF8}}
Write to the file, return {\tt true} on success, {\tt false} on failure.
Write to the file, return {\tt true} on success, {\tt false} on failure.
\membersection{wxTextFile::Open}\label{wxtextfileopen}
\membersection{wxTextFile::Open}\label{wxtextfileopen}
-\constfunc{bool}{Open}{\param{wxMBConv\&}{ conv = wxConvUTF8}}
+\constfunc{bool}{Open}{\param{const wxMBConv\&}{ conv = wxConvAuto()}}
-\constfunc{bool}{Open}{\param{const wxString\& }{strFile}, \param{wxMBConv\&}{ conv = wxConvUTF8}}
+\constfunc{bool}{Open}{\param{const wxString\& }{strFile}, \param{const wxMBConv\&}{ conv = wxConvAuto()}}
Open() opens the file with the given name or the name which was given in the
\helpref{constructor}{wxtextfilector} and also loads file in memory on
Open() opens the file with the given name or the name which was given in the
\helpref{constructor}{wxtextfilector} and also loads file in memory on
\membersection{wxTextFile::Write}\label{wxtextfilewrite}
\membersection{wxTextFile::Write}\label{wxtextfilewrite}
-\constfunc{bool}{Write}{\param{wxTextFileType }{typeNew = wxTextFileType\_None}, \param{wxMBConv\&}{ conv = wxConvUTF8}}
+\constfunc{bool}{Write}{\param{wxTextFileType }{typeNew = wxTextFileType\_None}, \param{const wxMBConv\&}{ conv = wxConvAuto()}}
Change the file on disk. The {\it typeNew} parameter allows you to change the
file format (default argument means "don't change type") and may be used to
Change the file on disk. The {\it typeNew} parameter allows you to change the
file format (default argument means "don't change type") and may be used to
\membersection{wxTextInputStream::wxTextInputStream}\label{wxtextinputstreamctor}
\func{}{wxTextInputStream}{\param{wxInputStream\&}{ stream}, \param{const wxString\&}{ sep=" $\backslash$t"},
\membersection{wxTextInputStream::wxTextInputStream}\label{wxtextinputstreamctor}
\func{}{wxTextInputStream}{\param{wxInputStream\&}{ stream}, \param{const wxString\&}{ sep=" $\backslash$t"},
- \param{wxMBConv\&}{ conv = wxConvUTF8} }
+ \param{const wxMBConv\&}{ conv = wxConvAuto()} }
Constructs a text stream associated to the given input stream.
Constructs a text stream associated to the given input stream.
\membersection{wxTextOutputStream::wxTextOutputStream}\label{wxtextoutputstreamctor}
\membersection{wxTextOutputStream::wxTextOutputStream}\label{wxtextoutputstreamctor}
-\func{}{wxTextOutputStream}{\param{wxOutputStream\&}{ stream}, \param{wxEOL}{ mode = wxEOL\_NATIVE}, \param{wxMBConv\&}{ conv = wxConvUTF8}}
+\func{}{wxTextOutputStream}{\param{wxOutputStream\&}{ stream}, \param{wxEOL}{ mode = wxEOL\_NATIVE}, \param{const wxMBConv\&}{ conv = wxConvAuto()}}
Constructs a text stream object associated to the given output stream.
Constructs a text stream object associated to the given output stream.
The following constructors allow you to construct wxString from a wide string
in ANSI build or from a C string in Unicode build.
The following constructors allow you to construct wxString from a wide string
in ANSI build or from a C string in Unicode build.
-\func{}{wxString}{\param{const wchar\_t*}{ psz}, \param{wxMBConv\&}{ conv}, \param{size\_t}{ nLength = wxSTRING\_MAXLEN}}
+\func{}{wxString}{\param{const wchar\_t*}{ psz}, \param{const wxMBConv\&}{ conv}, \param{size\_t}{ nLength = wxSTRING\_MAXLEN}}
Initializes the string from first \arg{nLength} characters of wide string.
The default value of {\tt wxSTRING\_MAXLEN} means take all the string.
Initializes the string from first \arg{nLength} characters of wide string.
The default value of {\tt wxSTRING\_MAXLEN} means take all the string.
\helpref{WC2MB}{wxmbconvwc2mb} method is called to
convert \arg{psz} to wide string. It is ignored in Unicode build.
\helpref{WC2MB}{wxmbconvwc2mb} method is called to
convert \arg{psz} to wide string. It is ignored in Unicode build.
-\func{}{wxString}{\param{const char*}{ psz}, \param{wxMBConv\&}{ conv = wxConvLibc}, \param{size\_t}{ nLength = wxSTRING\_MAXLEN}}
+\func{}{wxString}{\param{const char*}{ psz}, \param{const wxMBConv\&}{ conv = wxConvLibc}, \param{size\_t}{ nLength = wxSTRING\_MAXLEN}}
Initializes the string from first \arg{nLength} characters of C string.
The default value of {\tt wxSTRING\_MAXLEN} means take all the string.
Initializes the string from first \arg{nLength} characters of C string.
The default value of {\tt wxSTRING\_MAXLEN} means take all the string.
\membersection{wxString::char\_str}\label{wxstringcharstr}
\membersection{wxString::char\_str}\label{wxstringcharstr}
-\constfunc{wxWritableCharBuffer}{char\_str}{\param{wxMBConv\&}{ conv = wxConvLibc}}
+\constfunc{wxWritableCharBuffer}{char\_str}{\param{const wxMBConv\&}{ conv = wxConvLibc}}
Returns an object with string data that is implicitly convertible to
{\tt char*} pointer. Note that any change to the returned buffer is lost and so
Returns an object with string data that is implicitly convertible to
{\tt char*} pointer. Note that any change to the returned buffer is lost and so
\membersection{wxString::mb\_str}\label{wxstringmbstr}
\membersection{wxString::mb\_str}\label{wxstringmbstr}
-\constfunc{const char*}{mb\_str}{\param{wxMBConv\&}{ conv = wxConvLibc}}
+\constfunc{const char*}{mb\_str}{\param{const wxMBConv\&}{ conv = wxConvLibc}}
-\constfunc{const wxCharBuffer}{mb\_str}{\param{wxMBConv\&}{ conv = wxConvLibc}}
+\constfunc{const wxCharBuffer}{mb\_str}{\param{const wxMBConv\&}{ conv = wxConvLibc}}
Returns multibyte (C string) representation of the string.
In Unicode build, converts using \arg{conv}'s \helpref{cWC2MB}{wxmbconvcwc2mb}
Returns multibyte (C string) representation of the string.
In Unicode build, converts using \arg{conv}'s \helpref{cWC2MB}{wxmbconvcwc2mb}
\membersection{wxString::wc\_str}\label{wxstringwcstr}
\membersection{wxString::wc\_str}\label{wxstringwcstr}
-\constfunc{const wchar\_t*}{wc\_str}{\param{wxMBConv\&}{ conv}}
+\constfunc{const wchar\_t*}{wc\_str}{\param{const wxMBConv\&}{ conv}}
-\constfunc{const wxWCharBuffer}{wc\_str}{\param{wxMBConv\&}{ conv}}
+\constfunc{const wxWCharBuffer}{wc\_str}{\param{const wxMBConv\&}{ conv}}
Returns wide character representation of the string.
In ANSI build, converts using \arg{conv}'s \helpref{cMB2WC}{wxmbconvcmb2wc}
Returns wide character representation of the string.
In ANSI build, converts using \arg{conv}'s \helpref{cMB2WC}{wxmbconvcmb2wc}
const wxString& name,
wxPathFormat format = wxPATH_NATIVE) const = 0;
const wxString& name,
wxPathFormat format = wxPATH_NATIVE) const = 0;
+ // FIXME-UTF8: remove these from this file, they are used for ANSI
+ // build only
void SetConv(wxMBConv& conv) { m_pConv = &conv; }
wxMBConv& GetConv() const
{ if (m_pConv) return *m_pConv; else return wxConvLocal; }
void SetConv(wxMBConv& conv) { m_pConv = &conv; }
wxMBConv& GetConv() const
{ if (m_pConv) return *m_pConv; else return wxConvLocal; }
// returns the number of bytes written
size_t Write(const void *pBuf, size_t nCount);
// returns true on success
// returns the number of bytes written
size_t Write(const void *pBuf, size_t nCount);
// returns true on success
- bool Write(const wxString& s, const wxMBConv& conv = wxConvUTF8);
+ bool Write(const wxString& s, const wxMBConv& conv = wxMBConvUTF8());
// flush data not yet written
bool Flush();
// flush data not yet written
bool Flush();
// I/O (both functions return true on success, false on failure)
bool Write(const void *p, size_t n) { return m_file.Write(p, n) == n; }
// I/O (both functions return true on success, false on failure)
bool Write(const void *p, size_t n) { return m_file.Write(p, n) == n; }
- bool Write(const wxString& str, const wxMBConv& conv = wxConvUTF8)
+ bool Write(const wxString& str, const wxMBConv& conv = wxMBConvUTF8())
{ return m_file.Write(str, conv); }
// different ways to close the file
{ return m_file.Write(str, conv); }
// different ways to close the file
{ return true; }
virtual bool OnWrite(wxTextFileType WXUNUSED(typeNew),
{ return true; }
virtual bool OnWrite(wxTextFileType WXUNUSED(typeNew),
- const wxMBConv& WXUNUSED(conv) = wxConvUTF8)
+ const wxMBConv& WXUNUSED(conv) = wxMBConvUTF8())
{ return true; }
private:
{ return true; }
private:
{ return ConvertStr(str, n, conv); }
static wxCharBuffer ImplStr(const wchar_t* str)
{ return ConvertStr(str, n, conv); }
static wxCharBuffer ImplStr(const wchar_t* str)
- { return ConvertStr(str, npos, wxConvUTF8).data; }
+ { return ConvertStr(str, npos, wxMBConvUTF8()).data; }
static SubstrBufFromWC ImplStr(const wchar_t* str, size_t n)
static SubstrBufFromWC ImplStr(const wchar_t* str, size_t n)
- { return ConvertStr(str, n, wxConvUTF8); }
+ { return ConvertStr(str, n, wxMBConvUTF8()); }
size_t PosToImpl(size_t pos) const
{
size_t PosToImpl(size_t pos) const
{
const char* ToUTF8() const { return wx_str(); }
#elif wxUSE_UNICODE_WCHAR
static wxString FromUTF8(const char *utf8)
const char* ToUTF8() const { return wx_str(); }
#elif wxUSE_UNICODE_WCHAR
static wxString FromUTF8(const char *utf8)
- { return wxString(utf8, wxConvUTF8); }
+ { return wxString(utf8, wxMBConvUTF8()); }
static wxString FromUTF8(const char *utf8, size_t len)
static wxString FromUTF8(const char *utf8, size_t len)
- { return wxString(utf8, wxConvUTF8, len); }
- const wxCharBuffer utf8_str() const { return mb_str(wxConvUTF8); }
+ { return wxString(utf8, wxMBConvUTF8(), len); }
+ const wxCharBuffer utf8_str() const { return mb_str(wxMBConvUTF8()); }
const wxCharBuffer ToUTF8() const { return utf8_str(); }
#else // ANSI
static wxString FromUTF8(const char *utf8)
const wxCharBuffer ToUTF8() const { return utf8_str(); }
#else // ANSI
static wxString FromUTF8(const char *utf8)
- { return wxString(wxConvUTF8.cMB2WC(utf8)); }
+ { return wxString(wxMBConvUTF8().cMB2WC(utf8)); }
static wxString FromUTF8(const char *utf8, size_t len)
{
size_t wlen;
static wxString FromUTF8(const char *utf8, size_t len)
{
size_t wlen;
- wxWCharBuffer buf(wxConvUTF8.cMB2WC(utf8, len == npos ? wxNO_LEN : len, &wlen));
+ wxWCharBuffer buf(wxMBConvUTF8().cMB2WC(utf8, len == npos ? wxNO_LEN : len, &wlen));
return wxString(buf.data(), wlen);
}
return wxString(buf.data(), wlen);
}
- const wxCharBuffer utf8_str() const { return wxConvUTF8.cWC2MB(wc_str()); }
+ const wxCharBuffer utf8_str() const
+ { return wxMBConvUTF8().cWC2MB(wc_str()); }
const wxCharBuffer ToUTF8() const { return utf8_str(); }
#endif
const wxCharBuffer ToUTF8() const { return utf8_str(); }
#endif
// http://msdn.microsoft.com/library/en-us/intl/unicode_17si.asp
if ( m_CodePage == CP_UTF8 )
{
// http://msdn.microsoft.com/library/en-us/intl/unicode_17si.asp
if ( m_CodePage == CP_UTF8 )
{
- return wxConvUTF8.MB2WC(buf, psz, n);
+ return wxMBConvUTF8().MB2WC(buf, psz, n);
}
if ( m_CodePage == CP_UTF7 )
{
}
if ( m_CodePage == CP_UTF7 )
{
- return wxConvUTF7.MB2WC(buf, psz, n);
+ return wxMBConvUTF7().MB2WC(buf, psz, n);
wxWCharBuffer wbuf(wxConvLibc.cMB2WX(s));
if ( !wbuf )
wxWCharBuffer wbuf(wxConvLibc.cMB2WX(s));
if ( !wbuf )
- wbuf = wxConvUTF8.cMB2WX(s);
+ wbuf = wxMBConvUTF8().cMB2WX(s);
if ( !wbuf )
wbuf = wxConvISO8859_1.cMB2WX(s);
if ( !wbuf )
wbuf = wxConvISO8859_1.cMB2WX(s);
return SubstrBufFromMB("", 0);
// and then to UTF-8:
return SubstrBufFromMB("", 0);
// and then to UTF-8:
- SubstrBufFromMB buf(ConvertStr(wcBuf, wcLen, wxConvUTF8));
+ SubstrBufFromMB buf(ConvertStr(wcBuf, wcLen, wxMBConvUTF8()));
// widechar -> UTF-8 conversion isn't supposed to ever fail:
wxASSERT_MSG( buf.data, _T("conversion to UTF-8 failed") );
// widechar -> UTF-8 conversion isn't supposed to ever fail:
wxASSERT_MSG( buf.data, _T("conversion to UTF-8 failed") );
const wxWCharBuffer wxString::wc_str() const
{
const wxWCharBuffer wxString::wc_str() const
{
- return wxConvUTF8.cMB2WC(m_impl.c_str(),
- m_impl.length() + 1 /* size, not length */,
- NULL);
+ return wxMBConvUTF8().cMB2WC(m_impl.c_str(),
+ m_impl.length() + 1 /* size, not length */,
+ NULL);
}
const wxCharBuffer wxString::mb_str(const wxMBConv& conv) const
}
const wxCharBuffer wxString::mb_str(const wxMBConv& conv) const
size_t wcLen;
wxWCharBuffer wcBuf(
size_t wcLen;
wxWCharBuffer wcBuf(
- wxConvUTF8.cMB2WC(m_impl.c_str(),
- m_impl.length() + 1 /* size, not length */,
- &wcLen));
+ wxMBConvUTF8().cMB2WC(m_impl.c_str(),
+ m_impl.length() + 1 /* size, not length */,
+ &wcLen));
if ( !wcLen )
return wxCharBuffer("");
if ( !wcLen )
return wxCharBuffer("");