- Read(&s, szKey, szDefault);
- strncpy(s_szBuf, s, WXSIZEOF(s_szBuf));
+ Read(key, &s, defVal);
+ return s;
+}
+
+bool wxConfigBase::Read(const wxString& key, wxString *str, const wxString& defVal) const
+{
+ if (!Read(key, str))
+ {
+ *str = ExpandEnvVars(defVal);
+ return FALSE;
+ }
+ else
+ return TRUE;
+}
+
+bool wxConfigBase::Read(const wxString& key, long *pl, long defVal) const
+{
+ if (!Read(key, pl))
+ {
+ *pl = defVal;
+ return FALSE;
+ }
+ else
+ return TRUE;
+}
+
+bool wxConfigBase::Read(const wxString& key, double* val) const
+{
+ wxString str;
+ if (Read(key, & str))
+ {
+ *val = atof(str);
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+bool wxConfigBase::Read(const wxString& key, double* val, double defVal) const
+{
+ if (!Read(key, val))
+ {
+ *val = defVal;
+ return FALSE;
+ }
+ else
+ return TRUE;
+}
+
+bool wxConfigBase::Read(const wxString& key, bool* val) const
+{
+ long l;
+ if (Read(key, & l))
+ {
+ *val = (l != 0);
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+bool wxConfigBase::Read(const wxString& key, bool* val, bool defVal) const
+{
+ if (!Read(key, val))
+ {
+ *val = defVal;
+ return FALSE;
+ }
+ else
+ return TRUE;
+}
+
+// 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;
+}