-bool wxConfigBase::Read(const wxString& key, wxString *str, const wxString& defVal) const
-{
- if (!Read(key, str))
- {
- *str = ExpandEnvVars(defVal);
- return FALSE;
+// 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; \