X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1824493628261b2cb7ceceb431d85c427f1c976b..6c905cb7fdc856317f1e1db9c6d6aaa93c67920c:/src/common/config.cpp?ds=sidebyside diff --git a/src/common/config.cpp b/src/common/config.cpp index ec03c728f6..47cf94f498 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -10,10 +10,6 @@ // Licence: wxWindows license /////////////////////////////////////////////////////////////////////////////// -// ============================================================================ -// declarations -// ============================================================================ - // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- @@ -23,20 +19,23 @@ #include "wx/wxprec.h" +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#include + +#ifdef wxUSE_CONFIG + #ifdef __BORLANDC__ #pragma hdrstop #endif //__BORLANDC__ -#ifndef WX_PRECOMP - #include - #include -#endif //WX_PRECOMP - #include #include #include #include -#include +#include // we must include (one of) these files for wxConfigBase::Create #if defined(__WXMSW__) && defined(wxCONFIG_WIN32_NATIVE) @@ -71,7 +70,7 @@ bool wxConfigBase::ms_bAutoCreate = TRUE; // Not all args will always be used by derived classes, but // including them all in each class ensures compatibility. wxConfigBase::wxConfigBase(const wxString& appName, const wxString& vendorName, - const wxString& localFilename, const wxString& globalFilename, long style): + const wxString& WXUNUSED(localFilename), const wxString& WXUNUSED(globalFilename), long style): m_appName(appName), m_vendorName(vendorName), m_style(style) { m_bExpandEnvVars = TRUE; m_bRecordDefaults = FALSE; @@ -134,7 +133,7 @@ bool wxConfigBase::Read(const wxString& key, long *pl, long defVal) const bool wxConfigBase::Read(const wxString& key, double* val) const { wxString str; - if (Read(key, str)) + if (Read(key, & str)) { *val = atof(str); return TRUE; @@ -178,6 +177,24 @@ bool wxConfigBase::Read(const wxString& key, bool* val, bool defVal) const } // Convenience functions + +bool wxConfigBase::Read(const wxString& key, int *pi) const +{ + long l; + bool ret = Read(key, &l); + if (ret) + *pi = (int) l; + return ret; +} + +bool wxConfigBase::Read(const wxString& key, int *pi, int defVal) const +{ + long l; + bool ret = Read(key, &l, (long) defVal); + *pi = (int) l; + return ret; +} + bool wxConfigBase::Write(const wxString& key, double val) { wxString str; @@ -191,6 +208,15 @@ bool wxConfigBase::Write(const wxString& key, bool value) return Write(key, l); } +wxString wxConfigBase::ExpandEnvVars(const wxString& str) const +{ + wxString tmp; // Required for BC++ + if (IsExpandingEnvVars()) + tmp = wxExpandEnvVars(str); + else + tmp = str; + return tmp; +} // ---------------------------------------------------------------------------- // wxConfigPathChanger @@ -247,9 +273,9 @@ wxString wxExpandEnvVars(const wxString& str) { Bracket_None, Bracket_Normal = ')', - Bracket_Curly = '}', + Bracket_Curly = '}' #ifdef __WXMSW__ - Bracket_Windows = '%' // yeah, Windows people are a bit strange ;-) + ,Bracket_Windows = '%' // yeah, Windows people are a bit strange ;-) #endif }; @@ -382,4 +408,7 @@ void wxSplitPath(wxArrayString& aParts, const char *sz) } } +#endif + + // wxUSE_CONFIG