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

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

Issue 1441543002: Make vector_as_array use std::vector::data and switch a few directories. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, update //styleguide Created 5 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 7
8 #include <windows.h> 8 #include <windows.h>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/base_export.h" 12 #include "base/base_export.h"
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/stl_util.h"
15 #include "base/win/object_watcher.h" 14 #include "base/win/object_watcher.h"
16 #include "base/win/scoped_handle.h" 15 #include "base/win/scoped_handle.h"
17 16
18 namespace base { 17 namespace base {
19 namespace win { 18 namespace win {
20 19
21 // Utility class to read, write and manipulate the Windows Registry. 20 // Utility class to read, write and manipulate the Windows Registry.
22 // Registry vocabulary primer: a "key" is like a folder, in which there 21 // Registry vocabulary primer: a "key" is like a folder, in which there
23 // are "values", which are <name, data> pairs, with an associated data type. 22 // are "values", which are <name, data> pairs, with an associated data type.
24 // 23 //
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 172
174 DWORD ValueCount() const; 173 DWORD ValueCount() const;
175 174
176 // True while the iterator is valid. 175 // True while the iterator is valid.
177 bool Valid() const; 176 bool Valid() const;
178 177
179 // Advances to the next registry entry. 178 // Advances to the next registry entry.
180 void operator++(); 179 void operator++();
181 180
182 const wchar_t* Name() const { return name_.c_str(); } 181 const wchar_t* Name() const { return name_.c_str(); }
183 const wchar_t* Value() const { return vector_as_array(&value_); } 182 const wchar_t* Value() const {
183 // TODO(davidben): Switch this to value_.data() when
184 // https://crbug.com/555825 is resolved.
185 return value_.empty() ? nullptr : &*value_.begin();
186 }
184 // ValueSize() is in bytes. 187 // ValueSize() is in bytes.
185 DWORD ValueSize() const { return value_size_; } 188 DWORD ValueSize() const { return value_size_; }
186 DWORD Type() const { return type_; } 189 DWORD Type() const { return type_; }
187 190
188 int Index() const { return index_; } 191 int Index() const { return index_; }
189 192
190 private: 193 private:
191 // Read in the current values. 194 // Read in the current values.
192 bool Read(); 195 bool Read();
193 196
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 253
251 wchar_t name_[MAX_PATH]; 254 wchar_t name_[MAX_PATH];
252 255
253 DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator); 256 DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator);
254 }; 257 };
255 258
256 } // namespace win 259 } // namespace win
257 } // namespace base 260 } // namespace base
258 261
259 #endif // BASE_WIN_REGISTRY_H_ 262 #endif // BASE_WIN_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698