allow using both char* and wchar_t* in wxFileConfig and wxConfigBase, too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44592 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -203,8 +203,12 @@ public:
|
|||||||
|
|
||||||
// we have to provide a separate version for C strings as otherwise they
|
// we have to provide a separate version for C strings as otherwise they
|
||||||
// would be converted to bool and not to wxString as expected!
|
// would be converted to bool and not to wxString as expected!
|
||||||
bool Write(const wxString& key, const wxChar *value)
|
bool Write(const wxString& key, const char *value)
|
||||||
{ return Write(key, wxString(value)); }
|
{ return Write(key, wxString(value)); }
|
||||||
|
#if wxUSE_WCHAR_T
|
||||||
|
bool Write(const wxString& key, const wchar_t *value)
|
||||||
|
{ return Write(key, wxString(value)); }
|
||||||
|
#endif
|
||||||
|
|
||||||
// permanently writes all changes
|
// permanently writes all changes
|
||||||
virtual bool Flush(bool bCurrentOnly = false) = 0;
|
virtual bool Flush(bool bCurrentOnly = false) = 0;
|
||||||
|
@@ -111,8 +111,8 @@ public:
|
|||||||
//
|
//
|
||||||
// where file is the basename of szFile, ext is its extension
|
// where file is the basename of szFile, ext is its extension
|
||||||
// or .conf (Unix) or .ini (Win) if it has none
|
// or .conf (Unix) or .ini (Win) if it has none
|
||||||
static wxString GetGlobalFileName(const wxChar *szFile);
|
static wxString GetGlobalFileName(const wxString& file);
|
||||||
static wxString GetLocalFileName(const wxChar *szFile);
|
static wxString GetLocalFileName(const wxString& file);
|
||||||
|
|
||||||
// ctor & dtor
|
// ctor & dtor
|
||||||
// New constructor: one size fits all. Specify wxCONFIG_USE_LOCAL_FILE or
|
// New constructor: one size fits all. Specify wxCONFIG_USE_LOCAL_FILE or
|
||||||
|
@@ -328,12 +328,12 @@ wxString wxFileConfig::GetLocalDir()
|
|||||||
return strDir;
|
return strDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxFileConfig::GetGlobalFileName(const wxChar *szFile)
|
wxString wxFileConfig::GetGlobalFileName(const wxString& file)
|
||||||
{
|
{
|
||||||
wxString str = GetGlobalDir();
|
wxString str = GetGlobalDir();
|
||||||
str << szFile;
|
str << file;
|
||||||
|
|
||||||
if ( wxStrchr(szFile, wxT('.')) == NULL )
|
if ( wxStrchr(file, wxT('.')) == NULL )
|
||||||
#if defined( __WXMAC__ )
|
#if defined( __WXMAC__ )
|
||||||
str << wxT(" Preferences") ;
|
str << wxT(" Preferences") ;
|
||||||
#elif defined( __UNIX__ )
|
#elif defined( __UNIX__ )
|
||||||
@@ -345,7 +345,7 @@ wxString wxFileConfig::GetGlobalFileName(const wxChar *szFile)
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxFileConfig::GetLocalFileName(const wxChar *szFile)
|
wxString wxFileConfig::GetLocalFileName(const wxString& file)
|
||||||
{
|
{
|
||||||
#ifdef __VMS__
|
#ifdef __VMS__
|
||||||
// On VMS I saw the problem that the home directory was appended
|
// On VMS I saw the problem that the home directory was appended
|
||||||
@@ -360,10 +360,10 @@ wxString wxFileConfig::GetLocalFileName(const wxChar *szFile)
|
|||||||
str << wxT('.');
|
str << wxT('.');
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
str << szFile;
|
str << file;
|
||||||
|
|
||||||
#if defined(__WINDOWS__) || defined(__DOS__)
|
#if defined(__WINDOWS__) || defined(__DOS__)
|
||||||
if ( wxStrchr(szFile, wxT('.')) == NULL )
|
if ( wxStrchr(file, wxT('.')) == NULL )
|
||||||
str << wxT(".ini");
|
str << wxT(".ini");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user