X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8fdca65cf20ae4dba861fa6667d6e233cbb900cf..520e470fdd0daef09c77938db642e4583933c90d:/src/common/config.cpp?ds=sidebyside diff --git a/src/common/config.cpp b/src/common/config.cpp index e099f0af2c..5aac22351b 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -37,6 +37,7 @@ #include #include #include +#include // we must include (one of) these files for wxConfigBase::Create #if defined(__WXMSW__) && defined(wxCONFIG_WIN32_NATIVE) @@ -134,7 +135,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 +179,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;