Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: base/win/registry.h

Issue 6747014: Base: Last set of files to use BASE_API (for base.dll) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
11 11
12 #include "base/base_api.h"
12 #include "base/basictypes.h" 13 #include "base/basictypes.h"
13 14
14 namespace base { 15 namespace base {
15 namespace win { 16 namespace win {
16 17
17 // Utility class to read, write and manipulate the Windows Registry. 18 // Utility class to read, write and manipulate the Windows Registry.
18 // Registry vocabulary primer: a "key" is like a folder, in which there 19 // Registry vocabulary primer: a "key" is like a folder, in which there
19 // are "values", which are <name, data> pairs, with an associated data type. 20 // are "values", which are <name, data> pairs, with an associated data type.
20 // 21 //
21 // Note: 22 // Note:
22 // ReadValue family of functions guarantee that the return arguments 23 // ReadValue family of functions guarantee that the return arguments
23 // are not touched in case of failure. 24 // are not touched in case of failure.
24 class RegKey { 25 class BASE_API RegKey {
25 public: 26 public:
26 RegKey(); 27 RegKey();
27 RegKey(HKEY rootkey, const wchar_t* subkey, REGSAM access); 28 RegKey(HKEY rootkey, const wchar_t* subkey, REGSAM access);
28 ~RegKey(); 29 ~RegKey();
29 30
30 LONG Create(HKEY rootkey, const wchar_t* subkey, REGSAM access); 31 LONG Create(HKEY rootkey, const wchar_t* subkey, REGSAM access);
31 32
32 LONG CreateWithDisposition(HKEY rootkey, const wchar_t* subkey, 33 LONG CreateWithDisposition(HKEY rootkey, const wchar_t* subkey,
33 DWORD* disposition, REGSAM access); 34 DWORD* disposition, REGSAM access);
34 35
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 HKEY key_; // The registry key being iterated. 92 HKEY key_; // The registry key being iterated.
92 HANDLE watch_event_; 93 HANDLE watch_event_;
93 94
94 DISALLOW_COPY_AND_ASSIGN(RegKey); 95 DISALLOW_COPY_AND_ASSIGN(RegKey);
95 }; 96 };
96 97
97 // Iterates the entries found in a particular folder on the registry. 98 // Iterates the entries found in a particular folder on the registry.
98 // For this application I happen to know I wont need data size larger 99 // For this application I happen to know I wont need data size larger
99 // than MAX_PATH, but in real life this wouldn't neccessarily be 100 // than MAX_PATH, but in real life this wouldn't neccessarily be
100 // adequate. 101 // adequate.
101 class RegistryValueIterator { 102 class BASE_API RegistryValueIterator {
102 public: 103 public:
103 RegistryValueIterator(HKEY root_key, const wchar_t* folder_key); 104 RegistryValueIterator(HKEY root_key, const wchar_t* folder_key);
104 105
105 ~RegistryValueIterator(); 106 ~RegistryValueIterator();
106 107
107 DWORD ValueCount() const; 108 DWORD ValueCount() const;
108 109
109 // True while the iterator is valid. 110 // True while the iterator is valid.
110 bool Valid() const; 111 bool Valid() const;
111 112
(...skipping 19 matching lines...) Expand all
131 132
132 // Current values. 133 // Current values.
133 wchar_t name_[MAX_PATH]; 134 wchar_t name_[MAX_PATH];
134 wchar_t value_[MAX_PATH]; 135 wchar_t value_[MAX_PATH];
135 DWORD value_size_; 136 DWORD value_size_;
136 DWORD type_; 137 DWORD type_;
137 138
138 DISALLOW_COPY_AND_ASSIGN(RegistryValueIterator); 139 DISALLOW_COPY_AND_ASSIGN(RegistryValueIterator);
139 }; 140 };
140 141
141 class RegistryKeyIterator { 142 class BASE_API RegistryKeyIterator {
142 public: 143 public:
143 RegistryKeyIterator(HKEY root_key, const wchar_t* folder_key); 144 RegistryKeyIterator(HKEY root_key, const wchar_t* folder_key);
144 145
145 ~RegistryKeyIterator(); 146 ~RegistryKeyIterator();
146 147
147 DWORD SubkeyCount() const; 148 DWORD SubkeyCount() const;
148 149
149 // True while the iterator is valid. 150 // True while the iterator is valid.
150 bool Valid() const; 151 bool Valid() const;
151 152
(...skipping 16 matching lines...) Expand all
168 169
169 wchar_t name_[MAX_PATH]; 170 wchar_t name_[MAX_PATH];
170 171
171 DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator); 172 DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator);
172 }; 173 };
173 174
174 } // namespace win 175 } // namespace win
175 } // namespace base 176 } // namespace base
176 177
177 #endif // BASE_WIN_REGISTRY_H_ 178 #endif // BASE_WIN_REGISTRY_H_
OLDNEW
« base/base_api.h ('K') | « base/win/object_watcher.h ('k') | base/win/scoped_bstr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698