| 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 // 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 virtual bool RemoveWithoutPathExpansion(const std::string& key, | 331 virtual bool RemoveWithoutPathExpansion(const std::string& key, |
| 332 scoped_ptr<Value>* out_value); | 332 scoped_ptr<Value>* out_value); |
| 333 | 333 |
| 334 // Removes a path, clearing out all dictionaries on |path| that remain empty | 334 // Removes a path, clearing out all dictionaries on |path| that remain empty |
| 335 // after removing the value at |path|. | 335 // after removing the value at |path|. |
| 336 virtual bool RemovePath(const std::string& path, | 336 virtual bool RemovePath(const std::string& path, |
| 337 scoped_ptr<Value>* out_value); | 337 scoped_ptr<Value>* out_value); |
| 338 | 338 |
| 339 // Makes a copy of |this| but doesn't include empty dictionaries and lists in | 339 // Makes a copy of |this| but doesn't include empty dictionaries and lists in |
| 340 // the copy. This never returns NULL, even if |this| itself is empty. | 340 // the copy. This never returns NULL, even if |this| itself is empty. |
| 341 DictionaryValue* DeepCopyWithoutEmptyChildren() const; | 341 scoped_ptr<DictionaryValue> DeepCopyWithoutEmptyChildren() const; |
| 342 | 342 |
| 343 // Merge |dictionary| into this dictionary. This is done recursively, i.e. any | 343 // Merge |dictionary| into this dictionary. This is done recursively, i.e. any |
| 344 // sub-dictionaries will be merged as well. In case of key collisions, the | 344 // sub-dictionaries will be merged as well. In case of key collisions, the |
| 345 // passed in dictionary takes precedence and data already present will be | 345 // passed in dictionary takes precedence and data already present will be |
| 346 // replaced. Values within |dictionary| are deep-copied, so |dictionary| may | 346 // replaced. Values within |dictionary| are deep-copied, so |dictionary| may |
| 347 // be freed any time after this call. | 347 // be freed any time after this call. |
| 348 void MergeDictionary(const DictionaryValue* dictionary); | 348 void MergeDictionary(const DictionaryValue* dictionary); |
| 349 | 349 |
| 350 // Swaps contents with the |other| dictionary. | 350 // Swaps contents with the |other| dictionary. |
| 351 virtual void Swap(DictionaryValue* other); | 351 virtual void Swap(DictionaryValue* other); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_ |
| OLD | NEW |