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 // 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 setting and other persistable data. It includes the ability to | 6 // storing setting and other persistable data. It includes the ability to |
7 // specify (recursive) lists and dictionaries, so it's fairly expressive. | 7 // specify (recursive) lists and dictionaries, so it's fairly expressive. |
8 // However, the API is optimized for the common case, namely storing a | 8 // However, the API is optimized for the common case, namely storing a |
9 // hierarchical tree of simple values. Given a DictionaryValue root, you can | 9 // hierarchical tree of simple values. Given a DictionaryValue root, you can |
10 // easily do things like: | 10 // easily do things like: |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include <iterator> | 25 #include <iterator> |
26 #include <map> | 26 #include <map> |
27 #include <string> | 27 #include <string> |
28 #include <vector> | 28 #include <vector> |
29 | 29 |
30 #include "base/base_api.h" | 30 #include "base/base_api.h" |
31 #include "base/basictypes.h" | 31 #include "base/basictypes.h" |
32 #include "base/string16.h" | 32 #include "base/string16.h" |
33 #include "build/build_config.h" | 33 #include "build/build_config.h" |
34 | 34 |
| 35 // This file declares "using base::Value", etc. at the bottom, so that |
| 36 // current code can use these classes without the base namespace. In |
| 37 // new code, please always use base::Value, etc. or add your own |
| 38 // "using" declaration. |
| 39 // http://crbug.com/88666 |
| 40 namespace base { |
| 41 |
35 class BinaryValue; | 42 class BinaryValue; |
36 class DictionaryValue; | 43 class DictionaryValue; |
37 class FundamentalValue; | 44 class FundamentalValue; |
38 class ListValue; | 45 class ListValue; |
39 class StringValue; | 46 class StringValue; |
40 class Value; | 47 class Value; |
41 | 48 |
42 typedef std::vector<Value*> ValueVector; | 49 typedef std::vector<Value*> ValueVector; |
43 typedef std::map<std::string, Value*> ValueMap; | 50 typedef std::map<std::string, Value*> ValueMap; |
44 | 51 |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 | 455 |
449 // This method deserializes the subclass-specific format into a Value object. | 456 // This method deserializes the subclass-specific format into a Value object. |
450 // If the return value is non-NULL, the caller takes ownership of returned | 457 // If the return value is non-NULL, the caller takes ownership of returned |
451 // Value. If the return value is NULL, and if error_code is non-NULL, | 458 // Value. If the return value is NULL, and if error_code is non-NULL, |
452 // error_code will be set with the underlying error. | 459 // error_code will be set with the underlying error. |
453 // If |error_message| is non-null, it will be filled in with a formatted | 460 // If |error_message| is non-null, it will be filled in with a formatted |
454 // error message including the location of the error if appropriate. | 461 // error message including the location of the error if appropriate. |
455 virtual Value* Deserialize(int* error_code, std::string* error_str) = 0; | 462 virtual Value* Deserialize(int* error_code, std::string* error_str) = 0; |
456 }; | 463 }; |
457 | 464 |
| 465 } // namespace base |
| 466 |
| 467 // http://crbug.com/88666 |
| 468 using base::BinaryValue; |
| 469 using base::DictionaryValue; |
| 470 using base::FundamentalValue; |
| 471 using base::ListValue; |
| 472 using base::StringValue; |
| 473 using base::Value; |
| 474 using base::ValueMap; |
| 475 using base::ValueSerializer; |
| 476 using base::ValueVector; |
| 477 |
458 #endif // BASE_VALUES_H_ | 478 #endif // BASE_VALUES_H_ |
OLD | NEW |