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
This commit is contained in:
@@ -227,7 +227,7 @@ private:
|
|||||||
wxFileConfigGroup *m_pRootGroup, // the top (unnamed) group
|
wxFileConfigGroup *m_pRootGroup, // the top (unnamed) group
|
||||||
*m_pCurrentGroup; // the current group
|
*m_pCurrentGroup; // the current group
|
||||||
|
|
||||||
wxMBConv m_conv;
|
wxMBConv *m_conv;
|
||||||
|
|
||||||
#ifdef __UNIX__
|
#ifdef __UNIX__
|
||||||
int m_umask; // the umask to use for file creation
|
int m_umask; // the umask to use for file creation
|
||||||
|
@@ -394,7 +394,7 @@ void wxFileConfig::Init()
|
|||||||
{
|
{
|
||||||
wxTextFile fileGlobal(m_strGlobalFile);
|
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 */);
|
Parse(fileGlobal, false /* global */);
|
||||||
SetRootPath();
|
SetRootPath();
|
||||||
@@ -409,7 +409,7 @@ void wxFileConfig::Init()
|
|||||||
if ( !m_strLocalFile.empty() && wxFile::Exists(m_strLocalFile) )
|
if ( !m_strLocalFile.empty() && wxFile::Exists(m_strLocalFile) )
|
||||||
{
|
{
|
||||||
wxTextFile fileLocal(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 */);
|
Parse(fileLocal, true /* local */);
|
||||||
SetRootPath();
|
SetRootPath();
|
||||||
@@ -432,7 +432,7 @@ wxFileConfig::wxFileConfig(const wxString& appName, const wxString& vendorName,
|
|||||||
strLocal, strGlobal,
|
strLocal, strGlobal,
|
||||||
style),
|
style),
|
||||||
m_strLocalFile(strLocal), m_strGlobalFile(strGlobal),
|
m_strLocalFile(strLocal), m_strGlobalFile(strGlobal),
|
||||||
m_conv(conv)
|
m_conv(conv.Clone())
|
||||||
{
|
{
|
||||||
// Make up names for files if empty
|
// Make up names for files if empty
|
||||||
if ( m_strLocalFile.empty() && (style & wxCONFIG_USE_LOCAL_FILE) )
|
if ( m_strLocalFile.empty() && (style & wxCONFIG_USE_LOCAL_FILE) )
|
||||||
@@ -476,7 +476,7 @@ wxFileConfig::wxFileConfig(const wxString& appName, const wxString& vendorName,
|
|||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
|
|
||||||
wxFileConfig::wxFileConfig(wxInputStream &inStream, const wxMBConv& conv)
|
wxFileConfig::wxFileConfig(wxInputStream &inStream, const wxMBConv& conv)
|
||||||
: m_conv(conv)
|
: m_conv(conv.Clone())
|
||||||
{
|
{
|
||||||
// always local_file when this constructor is called (?)
|
// always local_file when this constructor is called (?)
|
||||||
SetStyle(GetStyle() | wxCONFIG_USE_LOCAL_FILE);
|
SetStyle(GetStyle() | wxCONFIG_USE_LOCAL_FILE);
|
||||||
@@ -1012,7 +1012,7 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */)
|
|||||||
{
|
{
|
||||||
wxString line = p->Text();
|
wxString line = p->Text();
|
||||||
line += wxTextFile::GetEOL();
|
line += wxTextFile::GetEOL();
|
||||||
if ( !file.Write(line, m_conv) )
|
if ( !file.Write(line, *m_conv) )
|
||||||
{
|
{
|
||||||
wxLogError(_("can't write user configuration file."));
|
wxLogError(_("can't write user configuration file."));
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user