| 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 453 |
| 447 // This method deserializes the subclass-specific format into a Value object. | 454 // This method deserializes the subclass-specific format into a Value object. |
| 448 // If the return value is non-NULL, the caller takes ownership of returned | 455 // If the return value is non-NULL, the caller takes ownership of returned |
| 449 // Value. If the return value is NULL, and if error_code is non-NULL, | 456 // Value. If the return value is NULL, and if error_code is non-NULL, |
| 450 // error_code will be set with the underlying error. | 457 // error_code will be set with the underlying error. |
| 451 // If |error_message| is non-null, it will be filled in with a formatted | 458 // If |error_message| is non-null, it will be filled in with a formatted |
| 452 // error message including the location of the error if appropriate. | 459 // error message including the location of the error if appropriate. |
| 453 virtual Value* Deserialize(int* error_code, std::string* error_str) = 0; | 460 virtual Value* Deserialize(int* error_code, std::string* error_str) = 0; |
| 454 }; | 461 }; |
| 455 | 462 |
| 463 } // namespace base |
| 464 |
| 465 // http://crbug.com/88666 |
| 466 using base::BinaryValue; |
| 467 using base::DictionaryValue; |
| 468 using base::FundamentalValue; |
| 469 using base::ListValue; |
| 470 using base::StringValue; |
| 471 using base::Value; |
| 472 using base::ValueMap; |
| 473 using base::ValueSerializer; |
| 474 using base::ValueVector; |
| 475 |
| 456 #endif // BASE_VALUES_H_ | 476 #endif // BASE_VALUES_H_ |
| OLD | NEW |