\helpref{HasGroup}{wxconfigbasehasgroup}\\
\helpref{HasEntry}{wxconfigbasehasentry}\\
-\helpref{Exists}{wxconfigbaseexists}
+\helpref{Exists}{wxconfigbaseexists}\\
+\helpref{GetEntryType}{wxconfigbasegetentrytype}
\membersection{Miscellaneous accessors}
Returns the application name.
+\membersection{wxConfigBase::GetEntryType}\label{wxconfigbasegetentrytype}
+
+\constfunc{enum wxConfigBase::EntryType}{GetEntryType}{\param{const wxString\& }{name}}
+
+Returns the type of the given entry or {\it Unknown} if the entry doesn't
+exist. This function should be used to decide which version of Read() should
+be used because some of wxConfig implementations will complain about type
+mismatch otherwise: e.g., an attempt to read a string value from an integer
+key with \helpref{wxRegConfig}{wxregconfig} will fail.
+
+The result is an element of enum EntryType:
+
+\begin{verbatim}
+ enum EntryType
+ {
+ Unknown,
+ String,
+ Boolean,
+ Integer,
+ Float
+ };
+\end{verbatim}
+
\membersection{wxConfigBase::GetFirstGroup}\label{wxconfigbasegetfirstgroup}
\constfunc{bool}{GetFirstGroup}{\param{wxString\& }{str}, \param{long\&}{
///////////////////////////////////////////////////////////////////////////////
// Name: confbase.h
// Purpose: declaration of the base class of all config implementations
-// (see also: fileconf.h and msw/regconf.h)
+// (see also: fileconf.h and msw/regconf.h and iniconf.h)
// Author: Karsten Ballüder & Vadim Zeitlin
// Modified by:
// Created: 07.04.98 (adapted from appconf.h)
class WXDLLEXPORT wxConfigBase
{
public:
+ // constants
+ // the type of an entry
+ enum EntryType
+ {
+ Unknown,
+ String,
+ Boolean,
+ Integer, // use Read(long *)
+ Float // use Read(double *)
+ };
+
// static functions
// sets the config object, returns the previous pointer
static wxConfigBase *Set(wxConfigBase *pConfig);
bool Exists(const wxString& strName) const
{ return HasGroup(strName) || HasEntry(strName); }
+ // get the entry type
+ virtual EntryType GetEntryType(const wxString& name) const
+ {
+ // by default all entries are strings
+ return HasEntry(name) ? String : Unknown;
+ }
+
// key access: returns TRUE if value was really read, FALSE if default used
// (and if the key is not found the default value is returned.)
// read a string from the key
wxString ExpandEnvVars(const wxString& str) const;
// misc accessors
- inline wxString GetAppName() const { return m_appName; }
- inline wxString GetVendorName() const { return m_vendorName; }
+ wxString GetAppName() const { return m_appName; }
+ wxString GetVendorName() const { return m_vendorName; }
- inline void SetAppName(const wxString& appName) { m_appName = appName; }
- inline void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; }
+ void SetAppName(const wxString& appName) { m_appName = appName; }
+ void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; }
- inline void SetStyle(long style) { m_style = style; }
- inline long GetStyle() const { return m_style; }
+ void SetStyle(long style) { m_style = style; }
+ long GetStyle() const { return m_style; }
protected:
static bool IsImmutable(const wxString& key)
#define sm_classwxConfig sm_classwxFileConfig
#endif
-#endif
-
+#endif
+
// wxUSE_CONFIG
#endif