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

Side by Side Diff: base/values.h

Issue 81183005: Remove JsonPrefStore pruning of empty values on write. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove else Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « base/test/data/prefs/write.golden.need_empty_value.json ('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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 // |out_value|. If |out_value| is NULL, the removed value will be deleted. 317 // |out_value|. If |out_value| is NULL, the removed value will be deleted.
318 // This method returns true if |path| is a valid path; otherwise it will 318 // This method returns true if |path| is a valid path; otherwise it will
319 // return false and the DictionaryValue object will be unchanged. 319 // return false and the DictionaryValue object will be unchanged.
320 virtual bool Remove(const std::string& path, scoped_ptr<Value>* out_value); 320 virtual bool Remove(const std::string& path, scoped_ptr<Value>* out_value);
321 321
322 // Like Remove(), but without special treatment of '.'. This allows e.g. URLs 322 // Like Remove(), but without special treatment of '.'. This allows e.g. URLs
323 // to be used as paths. 323 // to be used as paths.
324 virtual bool RemoveWithoutPathExpansion(const std::string& key, 324 virtual bool RemoveWithoutPathExpansion(const std::string& key,
325 scoped_ptr<Value>* out_value); 325 scoped_ptr<Value>* out_value);
326 326
327 // Removes a path, clearing out all dictionaries on |path| that remain empty
328 // after removing the value at |path|.
329 virtual bool RemovePath(const std::string& path,
330 scoped_ptr<Value>* out_value);
331
327 // Makes a copy of |this| but doesn't include empty dictionaries and lists in 332 // Makes a copy of |this| but doesn't include empty dictionaries and lists in
328 // the copy. This never returns NULL, even if |this| itself is empty. 333 // the copy. This never returns NULL, even if |this| itself is empty.
329 DictionaryValue* DeepCopyWithoutEmptyChildren() const; 334 DictionaryValue* DeepCopyWithoutEmptyChildren() const;
330 335
331 // Merge |dictionary| into this dictionary. This is done recursively, i.e. any 336 // Merge |dictionary| into this dictionary. This is done recursively, i.e. any
332 // sub-dictionaries will be merged as well. In case of key collisions, the 337 // sub-dictionaries will be merged as well. In case of key collisions, the
333 // passed in dictionary takes precedence and data already present will be 338 // passed in dictionary takes precedence and data already present will be
334 // replaced. Values within |dictionary| are deep-copied, so |dictionary| may 339 // replaced. Values within |dictionary| are deep-copied, so |dictionary| may
335 // be freed any time after this call. 340 // be freed any time after this call.
336 void MergeDictionary(const DictionaryValue* dictionary); 341 void MergeDictionary(const DictionaryValue* dictionary);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 527
523 } // namespace base 528 } // namespace base
524 529
525 // http://crbug.com/88666 530 // http://crbug.com/88666
526 using base::DictionaryValue; 531 using base::DictionaryValue;
527 using base::ListValue; 532 using base::ListValue;
528 using base::StringValue; 533 using base::StringValue;
529 using base::Value; 534 using base::Value;
530 535
531 #endif // BASE_VALUES_H_ 536 #endif // BASE_VALUES_H_
OLDNEW
« no previous file with comments | « base/test/data/prefs/write.golden.need_empty_value.json ('k') | base/values.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698