OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_WIN_REGISTRY_H_ | 5 #ifndef BASE_WIN_REGISTRY_H_ |
6 #define BASE_WIN_REGISTRY_H_ | 6 #define BASE_WIN_REGISTRY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <windows.h> | 9 #include <windows.h> |
10 #include <string> | 10 #include <string> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 // True while the key is valid. | 59 // True while the key is valid. |
60 bool Valid() const { return key_ != NULL; } | 60 bool Valid() const { return key_ != NULL; } |
61 | 61 |
62 // Kill a key and everything that live below it; please be careful when using | 62 // Kill a key and everything that live below it; please be careful when using |
63 // it. | 63 // it. |
64 LONG DeleteKey(const wchar_t* name); | 64 LONG DeleteKey(const wchar_t* name); |
65 | 65 |
66 // Deletes a single value within the key. | 66 // Deletes a single value within the key. |
67 LONG DeleteValue(const wchar_t* name); | 67 LONG DeleteValue(const wchar_t* name); |
68 | 68 |
69 LONG ReadValue(const wchar_t* name, void* data, DWORD* dsize, | 69 // Getters: |
70 | |
71 // Returns an int32 value. | |
72 LONG ReadValue(const wchar_t* name, DWORD* out_value) const; | |
M-A Ruel
2011/10/18 18:01:58
Don't.
Function overloading is banned by style.
tfarina
2011/10/18 18:03:27
Yeah I know :(
M-A Ruel
2011/10/18 18:05:17
Then fix WriteValue() to not use function overload
tfarina
2011/10/18 18:11:36
OK, I'll hold off in renaming them for now (it bre
tfarina
2011/10/18 18:40:43
Hum, reading it again, it doesn't explicit bans fu
| |
73 | |
74 // Returns an int64 value. | |
75 LONG ReadValue(const wchar_t* name, int64* out_value) const; | |
76 | |
77 // Returns a string value. | |
78 LONG ReadValue(const wchar_t* name, std::wstring* out_value) const; | |
79 | |
80 // Returns raw data. | |
81 LONG ReadValue(const wchar_t* name, | |
82 void* data, | |
83 DWORD* dsize, | |
70 DWORD* dtype) const; | 84 DWORD* dtype) const; |
71 LONG ReadValue(const wchar_t* name, std::wstring* value) const; | |
72 LONG ReadValueDW(const wchar_t* name, DWORD* value) const; | |
73 LONG ReadInt64(const wchar_t* name, int64* value) const; | |
74 | 85 |
75 LONG WriteValue(const wchar_t* name, const void* data, DWORD dsize, | 86 // Setters: |
87 | |
88 // Sets an int32 value. | |
89 LONG WriteValue(const wchar_t* name, DWORD in_value); | |
90 | |
91 // Sets a string value. | |
92 LONG WriteValue(const wchar_t* name, const wchar_t* in_value); | |
93 | |
94 // Sets raw data, including type. | |
95 LONG WriteValue(const wchar_t* name, | |
96 const void* data, | |
97 DWORD dsize, | |
76 DWORD dtype); | 98 DWORD dtype); |
77 LONG WriteValue(const wchar_t* name, const wchar_t* value); | |
78 LONG WriteValue(const wchar_t* name, DWORD value); | |
79 | 99 |
80 // Starts watching the key to see if any of its values have changed. | 100 // Starts watching the key to see if any of its values have changed. |
81 // The key must have been opened with the KEY_NOTIFY access privilege. | 101 // The key must have been opened with the KEY_NOTIFY access privilege. |
82 LONG StartWatching(); | 102 LONG StartWatching(); |
83 | 103 |
84 // If StartWatching hasn't been called, always returns false. | 104 // If StartWatching hasn't been called, always returns false. |
85 // Otherwise, returns true if anything under the key has changed. | 105 // Otherwise, returns true if anything under the key has changed. |
86 // This can't be const because the |watch_event_| may be refreshed. | 106 // This can't be const because the |watch_event_| may be refreshed. |
87 bool HasChanged(); | 107 bool HasChanged(); |
88 | 108 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 | 195 |
176 wchar_t name_[MAX_PATH]; | 196 wchar_t name_[MAX_PATH]; |
177 | 197 |
178 DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator); | 198 DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator); |
179 }; | 199 }; |
180 | 200 |
181 } // namespace win | 201 } // namespace win |
182 } // namespace base | 202 } // namespace base |
183 | 203 |
184 #endif // BASE_WIN_REGISTRY_H_ | 204 #endif // BASE_WIN_REGISTRY_H_ |
OLD | NEW |