+wxConfigBase *wxConfigBase::Create()
+{
+ if ( ms_bAutoCreate && ms_pConfig == NULL ) {
+ ms_pConfig =
+ #if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE
+ new wxRegConfig(wxTheApp->GetAppName(), wxTheApp->GetVendorName());
+ #else // either we're under Unix or wish to use files even under Windows
+ new wxFileConfig(wxTheApp->GetAppName());
+ #endif
+ }
+
+ return ms_pConfig;
+}
+
+// ----------------------------------------------------------------------------
+// wxConfigBase reading entries
+// ----------------------------------------------------------------------------
+
+// implement both Read() overloads for the given type in terms of DoRead()
+#define IMPLEMENT_READ_FOR_TYPE(name, type, deftype, extra) \
+ bool wxConfigBase::Read(const wxString& key, type *val) const \
+ { \
+ wxCHECK_MSG( val, FALSE, _T("wxConfig::Read(): NULL parameter") ); \
+ \
+ if ( !DoRead##name(key, val) ) \
+ return FALSE; \
+ \
+ *val = extra(*val); \
+ \
+ return TRUE; \
+ } \
+ \
+ bool wxConfigBase::Read(const wxString& key, \
+ type *val, \
+ deftype defVal) const \
+ { \
+ wxCHECK_MSG( val, FALSE, _T("wxConfig::Read(): NULL parameter") ); \
+ \
+ bool read = DoRead##name(key, val); \
+ if ( !read ) \
+ { \
+ if ( IsRecordingDefaults() ) \
+ { \
+ ((wxConfigBase *)this)->DoWrite##name(key, defVal); \
+ } \
+ \
+ *val = defVal; \
+ } \
+ \
+ *val = extra(*val); \
+ \
+ return read; \
+ }
+
+
+IMPLEMENT_READ_FOR_TYPE(String, wxString, const wxString&, ExpandEnvVars)
+IMPLEMENT_READ_FOR_TYPE(Long, long, long, long)
+IMPLEMENT_READ_FOR_TYPE(Int, int, int, int)
+IMPLEMENT_READ_FOR_TYPE(Double, double, double, double)
+IMPLEMENT_READ_FOR_TYPE(Bool, bool, bool, bool)
+
+#undef IMPLEMENT_READ_FOR_TYPE
+
+// the DoReadXXX() for the other types have implementation in the base class
+// but can be overridden in the derived ones
+bool wxConfigBase::DoReadInt(const wxString& key, int *pi) const
+{
+ wxCHECK_MSG( pi, FALSE, _T("wxConfig::Read(): NULL parameter") );
+
+ long l;
+ if ( !DoReadLong(key, &l) )
+ return FALSE;
+
+ wxASSERT_MSG( l < INT_MAX, _T("overflow in wxConfig::DoReadInt") );
+
+ *pi = (int)l;
+
+ return TRUE;
+}
+
+bool wxConfigBase::DoReadBool(const wxString& key, bool* val) const