| 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 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 // passed out via out_value. If |out_value| is NULL, the removed value will | 315 // passed out via out_value. If |out_value| is NULL, the removed value will |
| 316 // be deleted. This method returns true if |path| is a valid path; otherwise | 316 // be deleted. This method returns true if |path| is a valid path; otherwise |
| 317 // it will return false and the DictionaryValue object will be unchanged. | 317 // it will return false and the DictionaryValue object will be unchanged. |
| 318 virtual bool Remove(const std::string& path, Value** out_value); | 318 virtual bool Remove(const std::string& path, Value** out_value); |
| 319 | 319 |
| 320 // Like Remove(), but without special treatment of '.'. This allows e.g. URLs | 320 // Like Remove(), but without special treatment of '.'. This allows e.g. URLs |
| 321 // to be used as paths. | 321 // to be used as paths. |
| 322 virtual bool RemoveWithoutPathExpansion(const std::string& key, | 322 virtual bool RemoveWithoutPathExpansion(const std::string& key, |
| 323 Value** out_value); | 323 Value** out_value); |
| 324 | 324 |
| 325 // Removes a path, clearing out all dictionaries on |path| that remain empty |
| 326 // after removing the value at |path|. |
| 327 virtual bool RemovePath(const std::string& path, Value** out_value); |
| 328 |
| 325 // Makes a copy of |this| but doesn't include empty dictionaries and lists in | 329 // Makes a copy of |this| but doesn't include empty dictionaries and lists in |
| 326 // the copy. This never returns NULL, even if |this| itself is empty. | 330 // the copy. This never returns NULL, even if |this| itself is empty. |
| 327 DictionaryValue* DeepCopyWithoutEmptyChildren(); | 331 DictionaryValue* DeepCopyWithoutEmptyChildren(); |
| 328 | 332 |
| 329 // Merge |dictionary| into this dictionary. This is done recursively, i.e. any | 333 // Merge |dictionary| into this dictionary. This is done recursively, i.e. any |
| 330 // sub-dictionaries will be merged as well. In case of key collisions, the | 334 // sub-dictionaries will be merged as well. In case of key collisions, the |
| 331 // passed in dictionary takes precedence and data already present will be | 335 // passed in dictionary takes precedence and data already present will be |
| 332 // replaced. Values within |dictionary| are deep-copied, so |dictionary| may | 336 // replaced. Values within |dictionary| are deep-copied, so |dictionary| may |
| 333 // be freed any time after this call. | 337 // be freed any time after this call. |
| 334 void MergeDictionary(const DictionaryValue* dictionary); | 338 void MergeDictionary(const DictionaryValue* dictionary); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 | 529 |
| 526 } // namespace base | 530 } // namespace base |
| 527 | 531 |
| 528 // http://crbug.com/88666 | 532 // http://crbug.com/88666 |
| 529 using base::DictionaryValue; | 533 using base::DictionaryValue; |
| 530 using base::ListValue; | 534 using base::ListValue; |
| 531 using base::StringValue; | 535 using base::StringValue; |
| 532 using base::Value; | 536 using base::Value; |
| 533 | 537 |
| 534 #endif // BASE_VALUES_H_ | 538 #endif // BASE_VALUES_H_ |
| OLD | NEW |