wxConfig::GetEntryType() added
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2049 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -230,7 +230,8 @@ actually enumerating them, but you will probably never need them.
|
|||||||
|
|
||||||
\helpref{HasGroup}{wxconfigbasehasgroup}\\
|
\helpref{HasGroup}{wxconfigbasehasgroup}\\
|
||||||
\helpref{HasEntry}{wxconfigbasehasentry}\\
|
\helpref{HasEntry}{wxconfigbasehasentry}\\
|
||||||
\helpref{Exists}{wxconfigbaseexists}
|
\helpref{Exists}{wxconfigbaseexists}\\
|
||||||
|
\helpref{GetEntryType}{wxconfigbasegetentrytype}
|
||||||
|
|
||||||
\membersection{Miscellaneous accessors}
|
\membersection{Miscellaneous accessors}
|
||||||
|
|
||||||
@@ -436,6 +437,29 @@ Get the current config object. If there is no current object, creates one
|
|||||||
|
|
||||||
Returns the application name.
|
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}
|
\membersection{wxConfigBase::GetFirstGroup}\label{wxconfigbasegetfirstgroup}
|
||||||
|
|
||||||
\constfunc{bool}{GetFirstGroup}{\param{wxString\& }{str}, \param{long\&}{
|
\constfunc{bool}{GetFirstGroup}{\param{wxString\& }{str}, \param{long\&}{
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: confbase.h
|
// Name: confbase.h
|
||||||
// Purpose: declaration of the base class of all config implementations
|
// 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<6C>der & Vadim Zeitlin
|
// Author: Karsten Ball<6C>der & Vadim Zeitlin
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 07.04.98 (adapted from appconf.h)
|
// Created: 07.04.98 (adapted from appconf.h)
|
||||||
@@ -86,6 +86,17 @@ extern void wxSplitPath(wxArrayString& aParts, const char *sz);
|
|||||||
class WXDLLEXPORT wxConfigBase
|
class WXDLLEXPORT wxConfigBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// constants
|
||||||
|
// the type of an entry
|
||||||
|
enum EntryType
|
||||||
|
{
|
||||||
|
Unknown,
|
||||||
|
String,
|
||||||
|
Boolean,
|
||||||
|
Integer, // use Read(long *)
|
||||||
|
Float // use Read(double *)
|
||||||
|
};
|
||||||
|
|
||||||
// static functions
|
// static functions
|
||||||
// sets the config object, returns the previous pointer
|
// sets the config object, returns the previous pointer
|
||||||
static wxConfigBase *Set(wxConfigBase *pConfig);
|
static wxConfigBase *Set(wxConfigBase *pConfig);
|
||||||
@@ -146,6 +157,13 @@ public:
|
|||||||
bool Exists(const wxString& strName) const
|
bool Exists(const wxString& strName) const
|
||||||
{ return HasGroup(strName) || HasEntry(strName); }
|
{ 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
|
// 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.)
|
// (and if the key is not found the default value is returned.)
|
||||||
// read a string from the key
|
// read a string from the key
|
||||||
@@ -217,14 +235,14 @@ public:
|
|||||||
wxString ExpandEnvVars(const wxString& str) const;
|
wxString ExpandEnvVars(const wxString& str) const;
|
||||||
|
|
||||||
// misc accessors
|
// misc accessors
|
||||||
inline wxString GetAppName() const { return m_appName; }
|
wxString GetAppName() const { return m_appName; }
|
||||||
inline wxString GetVendorName() const { return m_vendorName; }
|
wxString GetVendorName() const { return m_vendorName; }
|
||||||
|
|
||||||
inline void SetAppName(const wxString& appName) { m_appName = appName; }
|
void SetAppName(const wxString& appName) { m_appName = appName; }
|
||||||
inline void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; }
|
void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; }
|
||||||
|
|
||||||
inline void SetStyle(long style) { m_style = style; }
|
void SetStyle(long style) { m_style = style; }
|
||||||
inline long GetStyle() const { return m_style; }
|
long GetStyle() const { return m_style; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static bool IsImmutable(const wxString& key)
|
static bool IsImmutable(const wxString& key)
|
||||||
@@ -293,8 +311,8 @@ private:
|
|||||||
#define sm_classwxConfig sm_classwxFileConfig
|
#define sm_classwxConfig sm_classwxFileConfig
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// wxUSE_CONFIG
|
// wxUSE_CONFIG
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user