]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/config.h
1 ///////////////////////////////////////////////////////////////////////////////
4 // Author: Karsten Ballüder & Vadim Zeitlin
6 // Created: 07.04.98 (adapted from appconf.h)
8 // Copyright: (c) 1997 Karsten Ballüder Ballueder@usa.net
9 // Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
10 // Licence: wxWindows license
11 ///////////////////////////////////////////////////////////////////////////////
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 /// shall we be case sensitive in parsing variable names?
21 #ifndef APPCONF_CASE_SENSITIVE
22 #define APPCONF_CASE_SENSITIVE FALSE
25 /// separates group and entry names
26 #ifndef APPCONF_PATH_SEPARATOR
27 #define APPCONF_PATH_SEPARATOR '/'
30 /// introduces immutable entries
31 #ifndef APPCONF_IMMUTABLE_PREFIX
32 #define APPCONF_IMMUTABLE_PREFIX '!'
35 /// should we use registry instead of configuration files under Win32?
36 #ifndef APPCONF_WIN32_NATIVE
37 #define APPCONF_WIN32_NATIVE TRUE
40 // ----------------------------------------------------------------------------
42 // ----------------------------------------------------------------------------
45 Replace environment variables ($SOMETHING) with their values. The format is
46 $VARNAME or ${VARNAME} where VARNAME contains alphanumeric characters and
47 '_' only. '$' must be escaped ('\$') in order to be taken literally.
49 wxString
ExpandEnvVars(const wxString
& str
);
51 // ----------------------------------------------------------------------------
52 // abstract base class wxConfig which defines the interface for derived classes
54 // wxConfig organizes the items in a tree-like structure (modeled after the
55 // Unix/Dos filesystem). There are groups (directories) and keys (files).
56 // There is always one current group given by the current path.
58 // Keys are pairs "key_name = value" where value may be of string or integer
59 // (long) type (@@@ doubles and other types such as wxDate coming soon).
60 // ----------------------------------------------------------------------------
64 // ctor & virtual dtor
69 // set current path: if the first character is '/', it's the absolute path,
70 // otherwise it's a relative path. '..' is supported. If the strPath
71 // doesn't exist it is created.
72 virtual void SetPath(const wxString
& strPath
) = 0;
73 // retrieve the current path (always as absolute path)
74 virtual const wxString
& GetPath() const = 0;
76 // enumeration: all functions here return false when there are no more items.
77 // you must pass the same lIndex to GetNext and GetFirst (don't modify it)
78 // enumerate subgroups
79 virtual bool GetFirstGroup(wxString
& str
, long& lIndex
) = 0;
80 virtual bool GetNextGroup (wxString
& str
, long& lIndex
) = 0;
82 virtual bool GetFirstEntry(wxString
& str
, long& lIndex
) = 0;
83 virtual bool GetNextEntry (wxString
& str
, long& lIndex
) = 0;
86 // read a string or long value from the key. If the key is not
87 // found the default value is returned.
88 virtual const char *Read(const char *szKey
,
89 const char *szDefault
= NULL
) const = 0;
90 virtual long Read(const char *szKey
, long lDefault
) const = 0;
92 // write the value (return true on success)
93 virtual bool Write(const char *szKey
, const char *szValue
) = 0;
94 virtual bool Write(const char *szKey
, long lValue
) = 0;
95 // permanently writes all changes
96 virtual bool Flush(bool bCurrentOnly
= FALSE
) = 0;
98 // delete entries/groups
99 // deletes the specified entry and the group it belongs to if
100 // it was the last key in it and the second parameter is true
101 virtual bool DeleteEntry(const char *szKey
,
102 bool bDeleteGroupIfEmpty
= TRUE
) = 0;
103 // delete the group (with all subgroups)
104 virtual bool DeleteGroup(const char *szKey
) = 0;
105 // delete the whole underlying object (disk file, registry key, ...)
106 // primarly for use by desinstallation routine.
107 virtual bool DeleteAll() = 0;
110 // true if environment variables are to be auto-expanded
111 bool m_bExpandEnvVars
;
114 // ----------------------------------------------------------------------------
115 // functions to create different config implementations
116 // ----------------------------------------------------------------------------
118 wxConfig
*CreateFileConfig(const wxString
& strFile
, bool bLocalOnly
= FALSE
);