]>
git.saurik.com Git - wxWidgets.git/blob - src/palmos/regconf.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: palmos/regconf.cpp
4 // Author: William Osborne
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "regconf.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
24 #include "wx/string.h"
34 #include "wx/config.h"
36 #include "wx/palmos/registry.h"
37 #include "wx/palmos/regconf.h"
39 // ----------------------------------------------------------------------------
41 // ----------------------------------------------------------------------------
43 // we put our data in HKLM\SOFTWARE_KEY\appname
44 #define SOFTWARE_KEY wxString(wxT("Software\\"))
46 // ----------------------------------------------------------------------------
48 // ----------------------------------------------------------------------------
50 // get the value if the key is opened and it exists
51 bool TryGetValue(const wxRegKey
& key
, const wxString
& str
, wxString
& strVal
)
56 bool TryGetValue(const wxRegKey
& key
, const wxString
& str
, long *plVal
)
61 // ============================================================================
63 // ============================================================================
65 // ----------------------------------------------------------------------------
67 // ----------------------------------------------------------------------------
69 // create the config object which stores its data under HKCU\vendor\app and, if
70 // style & wxCONFIG_USE_GLOBAL_FILE, under HKLM\vendor\app
71 wxRegConfig::wxRegConfig(const wxString
& appName
, const wxString
& vendorName
,
72 const wxString
& strLocal
, const wxString
& strGlobal
,
74 : wxConfigBase(appName
, vendorName
, strLocal
, strGlobal
, style
)
78 wxRegConfig::~wxRegConfig()
82 // ----------------------------------------------------------------------------
84 // ----------------------------------------------------------------------------
86 void wxRegConfig::SetPath(const wxString
& strPath
)
90 // ----------------------------------------------------------------------------
91 // enumeration (works only with current group)
92 // ----------------------------------------------------------------------------
94 #define LOCAL_MASK 0x8000
95 #define IS_LOCAL_INDEX(l) (((l) & LOCAL_MASK) != 0)
97 bool wxRegConfig::GetFirstGroup(wxString
& str
, long& lIndex
) const
102 bool wxRegConfig::GetNextGroup(wxString
& str
, long& lIndex
) const
107 bool wxRegConfig::GetFirstEntry(wxString
& str
, long& lIndex
) const
112 bool wxRegConfig::GetNextEntry(wxString
& str
, long& lIndex
) const
117 size_t wxRegConfig::GetNumberOfEntries(bool WXUNUSED(bRecursive
)) const
122 size_t wxRegConfig::GetNumberOfGroups(bool WXUNUSED(bRecursive
)) const
127 // ----------------------------------------------------------------------------
128 // tests for existence
129 // ----------------------------------------------------------------------------
131 bool wxRegConfig::HasGroup(const wxString
& key
) const
136 bool wxRegConfig::HasEntry(const wxString
& key
) const
141 wxConfigBase::EntryType
wxRegConfig::GetEntryType(const wxString
& key
) const
143 return wxConfigBase::Type_Integer
;
146 // ----------------------------------------------------------------------------
148 // ----------------------------------------------------------------------------
150 bool wxRegConfig::DoReadString(const wxString
& key
, wxString
*pStr
) const
155 // this exactly reproduces the string version above except for ExpandEnvVars(),
156 // we really should avoid this code duplication somehow...
158 bool wxRegConfig::DoReadLong(const wxString
& key
, long *plResult
) const
163 bool wxRegConfig::DoWriteString(const wxString
& key
, const wxString
& szValue
)
168 bool wxRegConfig::DoWriteLong(const wxString
& key
, long lValue
)
173 // ----------------------------------------------------------------------------
175 // ----------------------------------------------------------------------------
177 bool wxRegConfig::RenameEntry(const wxString
& oldName
, const wxString
& newName
)
182 bool wxRegConfig::RenameGroup(const wxString
& oldName
, const wxString
& newName
)
187 // ----------------------------------------------------------------------------
189 // ----------------------------------------------------------------------------
191 bool wxRegConfig::DeleteEntry(const wxString
& value
, bool bGroupIfEmptyAlso
)
196 bool wxRegConfig::DeleteGroup(const wxString
& key
)
201 bool wxRegConfig::DeleteAll()