]> git.saurik.com Git - wxWidgets.git/blame - interface/msw/registry.h
don't include private header in a sample
[wxWidgets.git] / interface / msw / registry.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: msw/registry.h
e54c96f1 3// Purpose: interface of wxRegKey
23324ae1
FM
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 33
d9faa1fe 34 @onlyfor{wxmsw}
7c913512 35
23324ae1
FM
36 @library{wxbase}
37 @category{FIXME}
38*/
7c913512 39class wxRegKey
23324ae1
FM
40{
41public:
42 //@{
43 /**
44 The constructor to set the full name of the key under a previously created
45 parent.
46 */
47 wxRegKey();
7c913512
FM
48 wxRegKey(const wxString& strKey);
49 wxRegKey(const wxRegKey& keyParent, const wxString& strKey);
23324ae1
FM
50 //@}
51
52 /**
53 Closes the key.
54 */
55 void Close();
56
57 /**
4cc4bfaf 58 Creates the key. Will fail if the key already exists and @a bOkIfExists is
23324ae1
FM
59 @false.
60 */
4cc4bfaf 61 bool Create(bool bOkIfExists = true);
23324ae1
FM
62
63 /**
64 Deletes the subkey with all of its subkeys/values recursively.
65 */
4cc4bfaf 66 void DeleteKey(const wxChar* szKey);
23324ae1
FM
67
68 /**
69 Deletes this key and all of its subkeys and values recursively.
70 */
71 void DeleteSelf();
72
73 /**
74 Deletes the named value.
75 */
4cc4bfaf 76 void DeleteValue(const wxChar* szKey);
23324ae1
FM
77
78 /**
79 Returns @true if the key exists.
80 */
328f5751 81 static bool Exists() const;
23324ae1
FM
82
83 /**
84 Gets the first key.
85 */
86 bool GetFirstKey(wxString& strKeyName, long& lIndex);
87
88 /**
89 Gets the first value of this key.
90 */
91 bool GetFirstValue(wxString& strValueName, long& lIndex);
92
93 /**
94 Gets information about the key.
d9faa1fe 95
7c913512 96 @param pnSubKeys
4cc4bfaf 97 The number of subkeys.
7c913512 98 @param pnMaxKeyLen
4cc4bfaf 99 The maximum length of the subkey name.
7c913512 100 @param pnValues
4cc4bfaf 101 The number of values.
7c913512 102 @param pnMaxValueLen
4cc4bfaf 103 The maximum length of a value.
23324ae1 104 */
4cc4bfaf 105 bool GetKeyInfo(size_t* pnSubKeys, size_t* pnValues,
328f5751 106 size_t* pnMaxValueLen) const;
23324ae1
FM
107
108 /**
109 Gets the name of the registry key.
110 */
328f5751 111 wxString GetName(bool bShortPrefix = true) const;
23324ae1
FM
112
113 /**
114 Gets the next key.
115 */
328f5751 116 bool GetNextKey(wxString& strKeyName, long& lIndex) const;
23324ae1
FM
117
118 /**
119 Gets the next key value for this key.
120 */
328f5751 121 bool GetNextValue(wxString& strValueName, long& lIndex) const;
23324ae1
FM
122
123 /**
124 Returns @true if given subkey exists.
125 */
328f5751 126 bool HasSubKey(const wxChar* szKey) const;
23324ae1
FM
127
128 /**
129 Returns @true if any subkeys exist.
130 */
328f5751 131 bool HasSubKeys() const;
23324ae1
FM
132
133 /**
134 Returns @true if the value exists.
135 */
328f5751 136 bool HasValue(const wxChar* szValue) const;
23324ae1
FM
137
138 /**
139 Returns @true if any values exist.
140 */
328f5751 141 bool HasValues() const;
23324ae1
FM
142
143 /**
144 Returns @true if this key is empty, nothing under this key.
145 */
328f5751 146 bool IsEmpty() const;
23324ae1
FM
147
148 /**
149 Returns @true if the key is opened.
150 */
328f5751 151 bool IsOpened() const;
23324ae1
FM
152
153 /**
154 Explicitly opens the key. This method also allows the key to be opened in
7c913512 155 read-only mode by passing @c Read() instead of default
23324ae1
FM
156 @c Write() parameter.
157 */
158 bool Open(AccessMode mode = Write);
159
160 //@{
161 /**
162 Retrieves the numeric value.
163 */
328f5751
FM
164 bool QueryValue(const wxChar* szValue, wxString& strValue) const;
165 const bool QueryValue(const wxChar* szValue, long* plValue) const;
23324ae1
FM
166 //@}
167
168 /**
169 Renames the key.
170 */
4cc4bfaf 171 bool Rename(const wxChar* szNewName);
23324ae1
FM
172
173 /**
174 Renames a value.
175 */
4cc4bfaf
FM
176 bool RenameValue(const wxChar* szValueOld,
177 const wxChar* szValueNew);
23324ae1
FM
178
179 //@{
180 /**
4cc4bfaf 181 Sets the given @a szValue which must be numeric, string or binary depending
23324ae1
FM
182 on the overload used. If the value doesn't exist, it is created.
183 */
4cc4bfaf
FM
184 bool SetValue(const wxChar* szValue, long lValue);
185 bool SetValue(const wxChar* szValue,
7c913512 186 const wxString& strValue);
4cc4bfaf 187 bool SetValue(const wxChar* szValue,
7c913512 188 const wxMemoryBuffer& buf);
23324ae1
FM
189 //@}
190};
e54c96f1 191