///////////////////////////////////////////////////////////////////////////////
-// Name: confbase.h
+// Name: wx/confbase.h
// Purpose: declaration of the base class of all config implementations
// (see also: fileconf.h and msw/regconf.h and iniconf.h)
-// Author: Karsten Ballüder & Vadim Zeitlin
+// Author: Karsten Ballueder & Vadim Zeitlin
// Modified by:
// Created: 07.04.98 (adapted from appconf.h)
// RCS-ID: $Id$
-// Copyright: (c) 1997 Karsten Ballüder Ballueder@usa.net
+// Copyright: (c) 1997 Karsten Ballueder Ballueder@usa.net
// Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
/// separates group and entry names (probably shouldn't be changed)
#ifndef wxCONFIG_PATH_SEPARATOR
- #define wxCONFIG_PATH_SEPARATOR _T('/')
+ #define wxCONFIG_PATH_SEPARATOR wxT('/')
#endif
/// introduces immutable entries
// (i.e. the ones which can't be changed from the local config file)
#ifndef wxCONFIG_IMMUTABLE_PREFIX
- #define wxCONFIG_IMMUTABLE_PREFIX _T('!')
+ #define wxCONFIG_IMMUTABLE_PREFIX wxT('!')
#endif
#if wxUSE_CONFIG
-#include "wx/string.h"
-
/// should we use registry instead of configuration files under Windows?
// (i.e. whether wxConfigBase::Create() will create a wxFileConfig (if it's
// false) or wxRegConfig (if it's true and we're under Win32))
#define wxUSE_CONFIG_NATIVE 1
#endif
+// not all compilers can deal with template Read/Write() methods, define this
+// symbol if the template functions are available
+#if (!defined(__VISUALC__) || __VISUALC__ > 1200) && \
+ !defined( __VMS ) && \
+ !(defined(__HP_aCC) && defined(__hppa)) && \
+ !defined (__DMC__)
+ #define wxHAS_CONFIG_TEMPLATE_RW
+#endif
+
// Style flags for constructor style parameter
enum
{
bool Read(const wxString& key, double* val) const;
bool Read(const wxString& key, double* val, double defVal) const;
+ // read a float
+ bool Read(const wxString& key, float* val) const;
+ bool Read(const wxString& key, float* val, float defVal) const;
+
// read a bool
bool Read(const wxString& key, bool* val) const;
bool Read(const wxString& key, bool* val, bool defVal) const;
// no default version since it does not make sense for binary data
#endif // wxUSE_BASE64
- // Causes ambiguities in VC++ 6 and OpenVMS (at least)
-#if ( (!defined(__VISUALC__) || __VISUALC__ > 1200) && !defined( __VMS ) && !defined (__DMC__))
+#ifdef wxHAS_CONFIG_TEMPLATE_RW
// read other types, for which wxFromString is defined
template <typename T>
bool Read(const wxString& key, T* value) const
}
return found;
}
-#endif
+#endif // wxHAS_CONFIG_TEMPLATE_RW
- // convenience functions returning directly the value
+ // convenience functions returning directly the value
wxString Read(const wxString& key,
const wxString& defVal = wxEmptyString) const
{ wxString s; (void)Read(key, &s, defVal); return s; }
// template Read() would be used
wxString Read(const wxString& key, const char* defVal) const
{ return Read(key, wxString(defVal)); }
-#if wxUSE_WCHAR_T
wxString Read(const wxString& key, const wchar_t* defVal) const
{ return Read(key, wxString(defVal)); }
-#endif
long ReadLong(const wxString& key, long defVal) const
{ long l; (void)Read(key, &l, defVal); return l; }
{ return Write(key, wxString(value)); }
bool Write(const wxString& key, const unsigned char *value)
{ return Write(key, wxString(value)); }
-#if wxUSE_WCHAR_T
bool Write(const wxString& key, const wchar_t *value)
{ return Write(key, wxString(value)); }
-#endif
// we also have to provide specializations for other types which we want to
// handle using the specialized DoWriteXXX() instead of the generic template
// version below
+ bool Write(const wxString& key, char value)
+ { return DoWriteLong(key, value); }
+
+ bool Write(const wxString& key, unsigned char value)
+ { return DoWriteLong(key, value); }
+
bool Write(const wxString& key, short value)
{ return DoWriteLong(key, value); }
m_strOldPath; // saved path
bool m_bChanged; // was the path changed?
- DECLARE_NO_COPY_CLASS(wxConfigPathChanger)
+ wxDECLARE_NO_COPY_CLASS(wxConfigPathChanger);
};
-// ----------------------------------------------------------------------------
-// the native wxConfigBase implementation
-// ----------------------------------------------------------------------------
-
-// under Windows we prefer to use the native implementation
-// wxIniConfig isn't native anywhere after droping win16 in wxWidgets 2.6
-#if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE
- #define wxConfig wxRegConfig
-#else // either we're under Unix or wish to use files even under Windows
- #define wxConfig wxFileConfig
-#endif
-
#endif // wxUSE_CONFIG
/*