]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: msw/registry.h | |
3 | // Purpose: documentation for wxRegKey class | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxRegKey | |
11 | @headerfile registry.h wx/msw/registry.h | |
7c913512 | 12 | |
23324ae1 FM |
13 | wxRegKey is a class representing the Windows registry (it is only available |
14 | under Windows). One can create, query and delete registry keys using this | |
15 | class. | |
7c913512 | 16 | |
23324ae1 FM |
17 | The Windows registry is easy to understand. There are five registry keys, |
18 | namely: | |
7c913512 | 19 | |
23324ae1 FM |
20 | HKEY_CLASSES_ROOT (HKCR) |
21 | HKEY_CURRENT_USER (HKCU) | |
22 | HKEY_LOCAL_MACHINE (HKLM) | |
23 | HKEY_CURRENT_CONFIG (HKCC) | |
24 | HKEY_USERS (HKU) | |
7c913512 | 25 | |
23324ae1 | 26 | After creating a key, it can hold a value. The values can be: |
7c913512 | 27 | |
23324ae1 FM |
28 | String Value |
29 | Binary Value | |
30 | DWORD Value | |
31 | Multi String Value | |
32 | Expandable String Value | |
7c913512 FM |
33 | |
34 | ||
23324ae1 FM |
35 | @library{wxbase} |
36 | @category{FIXME} | |
37 | */ | |
7c913512 | 38 | class wxRegKey |
23324ae1 FM |
39 | { |
40 | public: | |
41 | //@{ | |
42 | /** | |
43 | The constructor to set the full name of the key under a previously created | |
44 | parent. | |
45 | */ | |
46 | wxRegKey(); | |
7c913512 FM |
47 | wxRegKey(const wxString& strKey); |
48 | wxRegKey(const wxRegKey& keyParent, const wxString& strKey); | |
23324ae1 FM |
49 | //@} |
50 | ||
51 | /** | |
52 | Closes the key. | |
53 | */ | |
54 | void Close(); | |
55 | ||
56 | /** | |
4cc4bfaf | 57 | Creates the key. Will fail if the key already exists and @a bOkIfExists is |
23324ae1 FM |
58 | @false. |
59 | */ | |
4cc4bfaf | 60 | bool Create(bool bOkIfExists = true); |
23324ae1 FM |
61 | |
62 | /** | |
63 | Deletes the subkey with all of its subkeys/values recursively. | |
64 | */ | |
4cc4bfaf | 65 | void DeleteKey(const wxChar* szKey); |
23324ae1 FM |
66 | |
67 | /** | |
68 | Deletes this key and all of its subkeys and values recursively. | |
69 | */ | |
70 | void DeleteSelf(); | |
71 | ||
72 | /** | |
73 | Deletes the named value. | |
74 | */ | |
4cc4bfaf | 75 | void DeleteValue(const wxChar* szKey); |
23324ae1 FM |
76 | |
77 | /** | |
78 | Returns @true if the key exists. | |
79 | */ | |
328f5751 | 80 | static bool Exists() const; |
23324ae1 FM |
81 | |
82 | /** | |
83 | Gets the first key. | |
84 | */ | |
85 | bool GetFirstKey(wxString& strKeyName, long& lIndex); | |
86 | ||
87 | /** | |
88 | Gets the first value of this key. | |
89 | */ | |
90 | bool GetFirstValue(wxString& strValueName, long& lIndex); | |
91 | ||
92 | /** | |
93 | Gets information about the key. | |
94 | ||
7c913512 | 95 | @param pnSubKeys |
4cc4bfaf | 96 | The number of subkeys. |
7c913512 | 97 | @param pnMaxKeyLen |
4cc4bfaf | 98 | The maximum length of the subkey name. |
7c913512 | 99 | @param pnValues |
4cc4bfaf | 100 | The number of values. |
7c913512 | 101 | @param pnMaxValueLen |
4cc4bfaf | 102 | The maximum length of a value. |
23324ae1 | 103 | */ |
4cc4bfaf | 104 | bool GetKeyInfo(size_t* pnSubKeys, size_t* pnValues, |
328f5751 | 105 | size_t* pnMaxValueLen) const; |
23324ae1 FM |
106 | |
107 | /** | |
108 | Gets the name of the registry key. | |
109 | */ | |
328f5751 | 110 | wxString GetName(bool bShortPrefix = true) const; |
23324ae1 FM |
111 | |
112 | /** | |
113 | Gets the next key. | |
114 | */ | |
328f5751 | 115 | bool GetNextKey(wxString& strKeyName, long& lIndex) const; |
23324ae1 FM |
116 | |
117 | /** | |
118 | Gets the next key value for this key. | |
119 | */ | |
328f5751 | 120 | bool GetNextValue(wxString& strValueName, long& lIndex) const; |
23324ae1 FM |
121 | |
122 | /** | |
123 | Returns @true if given subkey exists. | |
124 | */ | |
328f5751 | 125 | bool HasSubKey(const wxChar* szKey) const; |
23324ae1 FM |
126 | |
127 | /** | |
128 | Returns @true if any subkeys exist. | |
129 | */ | |
328f5751 | 130 | bool HasSubKeys() const; |
23324ae1 FM |
131 | |
132 | /** | |
133 | Returns @true if the value exists. | |
134 | */ | |
328f5751 | 135 | bool HasValue(const wxChar* szValue) const; |
23324ae1 FM |
136 | |
137 | /** | |
138 | Returns @true if any values exist. | |
139 | */ | |
328f5751 | 140 | bool HasValues() const; |
23324ae1 FM |
141 | |
142 | /** | |
143 | Returns @true if this key is empty, nothing under this key. | |
144 | */ | |
328f5751 | 145 | bool IsEmpty() const; |
23324ae1 FM |
146 | |
147 | /** | |
148 | Returns @true if the key is opened. | |
149 | */ | |
328f5751 | 150 | bool IsOpened() const; |
23324ae1 FM |
151 | |
152 | /** | |
153 | Explicitly opens the key. This method also allows the key to be opened in | |
7c913512 | 154 | read-only mode by passing @c Read() instead of default |
23324ae1 FM |
155 | @c Write() parameter. |
156 | */ | |
157 | bool Open(AccessMode mode = Write); | |
158 | ||
159 | //@{ | |
160 | /** | |
161 | Retrieves the numeric value. | |
162 | */ | |
328f5751 FM |
163 | bool QueryValue(const wxChar* szValue, wxString& strValue) const; |
164 | const bool QueryValue(const wxChar* szValue, long* plValue) const; | |
23324ae1 FM |
165 | //@} |
166 | ||
167 | /** | |
168 | Renames the key. | |
169 | */ | |
4cc4bfaf | 170 | bool Rename(const wxChar* szNewName); |
23324ae1 FM |
171 | |
172 | /** | |
173 | Renames a value. | |
174 | */ | |
4cc4bfaf FM |
175 | bool RenameValue(const wxChar* szValueOld, |
176 | const wxChar* szValueNew); | |
23324ae1 FM |
177 | |
178 | //@{ | |
179 | /** | |
4cc4bfaf | 180 | Sets the given @a szValue which must be numeric, string or binary depending |
23324ae1 FM |
181 | on the overload used. If the value doesn't exist, it is created. |
182 | */ | |
4cc4bfaf FM |
183 | bool SetValue(const wxChar* szValue, long lValue); |
184 | bool SetValue(const wxChar* szValue, | |
7c913512 | 185 | const wxString& strValue); |
4cc4bfaf | 186 | bool SetValue(const wxChar* szValue, |
7c913512 | 187 | const wxMemoryBuffer& buf); |
23324ae1 FM |
188 | //@} |
189 | }; |