From: Vadim Zeitlin Date: Wed, 5 Apr 2006 16:54:02 +0000 (+0000) Subject: added wxMBConv::Clone() to be able to copy conversion objects polymorphically X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e835ec0100b227c36a737df0ad03a249708642e7?ds=inline added wxMBConv::Clone() to be able to copy conversion objects polymorphically git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38579 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/fileconf.h b/include/wx/fileconf.h index ebb4ab5b29..140b707157 100644 --- a/include/wx/fileconf.h +++ b/include/wx/fileconf.h @@ -227,7 +227,7 @@ private: wxFileConfigGroup *m_pRootGroup, // the top (unnamed) group *m_pCurrentGroup; // the current group - wxMBConv m_conv; + wxMBConv *m_conv; #ifdef __UNIX__ int m_umask; // the umask to use for file creation diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 5e84cf2c41..1b0eb091a3 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -394,7 +394,7 @@ void wxFileConfig::Init() { wxTextFile fileGlobal(m_strGlobalFile); - if ( fileGlobal.Open(m_conv/*ignored in ANSI build*/) ) + if ( fileGlobal.Open(*m_conv/*ignored in ANSI build*/) ) { Parse(fileGlobal, false /* global */); SetRootPath(); @@ -409,7 +409,7 @@ void wxFileConfig::Init() if ( !m_strLocalFile.empty() && wxFile::Exists(m_strLocalFile) ) { wxTextFile fileLocal(m_strLocalFile); - if ( fileLocal.Open(m_conv/*ignored in ANSI build*/) ) + if ( fileLocal.Open(*m_conv/*ignored in ANSI build*/) ) { Parse(fileLocal, true /* local */); SetRootPath(); @@ -432,7 +432,7 @@ wxFileConfig::wxFileConfig(const wxString& appName, const wxString& vendorName, strLocal, strGlobal, style), m_strLocalFile(strLocal), m_strGlobalFile(strGlobal), - m_conv(conv) + m_conv(conv.Clone()) { // Make up names for files if empty if ( m_strLocalFile.empty() && (style & wxCONFIG_USE_LOCAL_FILE) ) @@ -476,7 +476,7 @@ wxFileConfig::wxFileConfig(const wxString& appName, const wxString& vendorName, #if wxUSE_STREAMS wxFileConfig::wxFileConfig(wxInputStream &inStream, const wxMBConv& conv) - : m_conv(conv) + : m_conv(conv.Clone()) { // always local_file when this constructor is called (?) SetStyle(GetStyle() | wxCONFIG_USE_LOCAL_FILE); @@ -1012,7 +1012,7 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */) { wxString line = p->Text(); line += wxTextFile::GetEOL(); - if ( !file.Write(line, m_conv) ) + if ( !file.Write(line, *m_conv) ) { wxLogError(_("can't write user configuration file.")); return false;