Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 { return value_.data(); } |
|
danakj
2015/11/14 00:39:01
use &*begin() here with a TODO to use data() point
davidben
2015/11/16 21:27:38
Done, but with the check for .empty()
danakj
2015/11/16 21:38:37
Sounds like you can just use data() here too from
davidben
2015/11/16 21:55:37
Done.
| |
| 184 // ValueSize() is in bytes. | 183 // ValueSize() is in bytes. |
| 185 DWORD ValueSize() const { return value_size_; } | 184 DWORD ValueSize() const { return value_size_; } |
| 186 DWORD Type() const { return type_; } | 185 DWORD Type() const { return type_; } |
| 187 | 186 |
| 188 int Index() const { return index_; } | 187 int Index() const { return index_; } |
| 189 | 188 |
| 190 private: | 189 private: |
| 191 // Read in the current values. | 190 // Read in the current values. |
| 192 bool Read(); | 191 bool Read(); |
| 193 | 192 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 | 249 |
| 251 wchar_t name_[MAX_PATH]; | 250 wchar_t name_[MAX_PATH]; |
| 252 | 251 |
| 253 DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator); | 252 DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator); |
| 254 }; | 253 }; |
| 255 | 254 |
| 256 } // namespace win | 255 } // namespace win |
| 257 } // namespace base | 256 } // namespace base |
| 258 | 257 |
| 259 #endif // BASE_WIN_REGISTRY_H_ | 258 #endif // BASE_WIN_REGISTRY_H_ |
| OLD | NEW |