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

Side by Side Diff: base/values.h

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « base/trace_event/winheap_dump_provider_win.cc ('k') | base/values.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This file specifies a recursive data storage class called Value intended for 5 // This file specifies a recursive data storage class called Value intended for
6 // storing settings and other persistable data. 6 // storing settings and other persistable data.
7 // 7 //
8 // A Value represents something that can be stored in JSON or passed to/from 8 // A Value represents something that can be stored in JSON or passed to/from
9 // JavaScript. As such, it is NOT a generalized variant type, since only the 9 // JavaScript. As such, it is NOT a generalized variant type, since only the
10 // types supported by JavaScript/JSON are supported. 10 // types supported by JavaScript/JSON are supported.
(...skipping 12 matching lines...) Expand all
23 #include <map> 23 #include <map>
24 #include <string> 24 #include <string>
25 #include <utility> 25 #include <utility>
26 #include <vector> 26 #include <vector>
27 27
28 #include "base/base_export.h" 28 #include "base/base_export.h"
29 #include "base/basictypes.h" 29 #include "base/basictypes.h"
30 #include "base/compiler_specific.h" 30 #include "base/compiler_specific.h"
31 #include "base/memory/scoped_ptr.h" 31 #include "base/memory/scoped_ptr.h"
32 #include "base/strings/string16.h" 32 #include "base/strings/string16.h"
33 #include "base/strings/string_piece.h"
33 34
34 namespace base { 35 namespace base {
35 36
36 class BinaryValue; 37 class BinaryValue;
37 class DictionaryValue; 38 class DictionaryValue;
38 class FundamentalValue; 39 class FundamentalValue;
39 class ListValue; 40 class ListValue;
40 class StringValue; 41 class StringValue;
41 class Value; 42 class Value;
42 43
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 const string16& in_value); 264 const string16& in_value);
264 265
265 // Gets the Value associated with the given path starting from this object. 266 // Gets the Value associated with the given path starting from this object.
266 // A path has the form "<key>" or "<key>.<key>.[...]", where "." indexes 267 // A path has the form "<key>" or "<key>.<key>.[...]", where "." indexes
267 // into the next DictionaryValue down. If the path can be resolved 268 // into the next DictionaryValue down. If the path can be resolved
268 // successfully, the value for the last key in the path will be returned 269 // successfully, the value for the last key in the path will be returned
269 // through the |out_value| parameter, and the function will return true. 270 // through the |out_value| parameter, and the function will return true.
270 // Otherwise, it will return false and |out_value| will be untouched. 271 // Otherwise, it will return false and |out_value| will be untouched.
271 // Note that the dictionary always owns the value that's returned. 272 // Note that the dictionary always owns the value that's returned.
272 // |out_value| is optional and will only be set if non-NULL. 273 // |out_value| is optional and will only be set if non-NULL.
273 bool Get(const std::string& path, const Value** out_value) const; 274 bool Get(StringPiece path, const Value** out_value) const;
274 bool Get(const std::string& path, Value** out_value); 275 bool Get(StringPiece path, Value** out_value);
275 276
276 // These are convenience forms of Get(). The value will be retrieved 277 // These are convenience forms of Get(). The value will be retrieved
277 // and the return value will be true if the path is valid and the value at 278 // and the return value will be true if the path is valid and the value at
278 // the end of the path can be returned in the form specified. 279 // the end of the path can be returned in the form specified.
279 // |out_value| is optional and will only be set if non-NULL. 280 // |out_value| is optional and will only be set if non-NULL.
280 bool GetBoolean(const std::string& path, bool* out_value) const; 281 bool GetBoolean(const std::string& path, bool* out_value) const;
281 bool GetInteger(const std::string& path, int* out_value) const; 282 bool GetInteger(const std::string& path, int* out_value) const;
282 // Values of both type TYPE_INTEGER and TYPE_DOUBLE can be obtained as 283 // Values of both type TYPE_INTEGER and TYPE_DOUBLE can be obtained as
283 // doubles. 284 // doubles.
284 bool GetDouble(const std::string& path, double* out_value) const; 285 bool GetDouble(const std::string& path, double* out_value) const;
285 bool GetString(const std::string& path, std::string* out_value) const; 286 bool GetString(const std::string& path, std::string* out_value) const;
286 bool GetString(const std::string& path, string16* out_value) const; 287 bool GetString(const std::string& path, string16* out_value) const;
287 bool GetStringASCII(const std::string& path, std::string* out_value) const; 288 bool GetStringASCII(const std::string& path, std::string* out_value) const;
288 bool GetBinary(const std::string& path, const BinaryValue** out_value) const; 289 bool GetBinary(const std::string& path, const BinaryValue** out_value) const;
289 bool GetBinary(const std::string& path, BinaryValue** out_value); 290 bool GetBinary(const std::string& path, BinaryValue** out_value);
290 bool GetDictionary(const std::string& path, 291 bool GetDictionary(StringPiece path, const DictionaryValue** out_value) const;
291 const DictionaryValue** out_value) const; 292 bool GetDictionary(StringPiece path, DictionaryValue** out_value);
292 bool GetDictionary(const std::string& path, DictionaryValue** out_value);
293 bool GetList(const std::string& path, const ListValue** out_value) const; 293 bool GetList(const std::string& path, const ListValue** out_value) const;
294 bool GetList(const std::string& path, ListValue** out_value); 294 bool GetList(const std::string& path, ListValue** out_value);
295 295
296 // Like Get(), but without special treatment of '.'. This allows e.g. URLs to 296 // Like Get(), but without special treatment of '.'. This allows e.g. URLs to
297 // be used as paths. 297 // be used as paths.
298 bool GetWithoutPathExpansion(const std::string& key, 298 bool GetWithoutPathExpansion(const std::string& key,
299 const Value** out_value) const; 299 const Value** out_value) const;
300 bool GetWithoutPathExpansion(const std::string& key, Value** out_value); 300 bool GetWithoutPathExpansion(const std::string& key, Value** out_value);
301 bool GetBooleanWithoutPathExpansion(const std::string& key, 301 bool GetBooleanWithoutPathExpansion(const std::string& key,
302 bool* out_value) const; 302 bool* out_value) const;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 } 549 }
550 550
551 BASE_EXPORT inline std::ostream& operator<<(std::ostream& out, 551 BASE_EXPORT inline std::ostream& operator<<(std::ostream& out,
552 const ListValue& value) { 552 const ListValue& value) {
553 return out << static_cast<const Value&>(value); 553 return out << static_cast<const Value&>(value);
554 } 554 }
555 555
556 } // namespace base 556 } // namespace base
557 557
558 #endif // BASE_VALUES_H_ 558 #endif // BASE_VALUES_H_
OLDNEW
« no previous file with comments | « base/trace_event/winheap_dump_provider_win.cc ('k') | base/values.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698