diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-02 00:20:32 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-02 00:20:32 +0000 |
commit | ec330b5c0f38e22470a15460a06309658b18ce14 (patch) | |
tree | 5aab1796997ec38122489bd7ed2b722f19f5ac84 /base/values.h | |
parent | 855b2d52e0a1ba1247eba0c9b79f6f7ba06f19df (diff) | |
download | chromium_src-ec330b5c0f38e22470a15460a06309658b18ce14.zip chromium_src-ec330b5c0f38e22470a15460a06309658b18ce14.tar.gz chromium_src-ec330b5c0f38e22470a15460a06309658b18ce14.tar.bz2 |
Remove emtpy lists and empty dictionaries from Preferences and
Local State when writing to disk.
BUG=28836
Review URL: http://codereview.chromium.org/449074
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33518 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/values.h')
-rw-r--r-- | base/values.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/base/values.h b/base/values.h index 82a29fd..1bbc581 100644 --- a/base/values.h +++ b/base/values.h @@ -287,6 +287,10 @@ class DictionaryValue : public Value { // to be used as paths. bool RemoveWithoutPathExpansion(const std::wstring& key, Value** out_value); + // Makes a copy of |this| but doesn't include empty dictionaries and lists in + // the copy. This never returns NULL, even if |this| itself is empty. + DictionaryValue* DeepCopyWithoutEmptyChildren(); + // This class provides an iterator for the keys in the dictionary. // It can't be used to modify the dictionary. // @@ -331,6 +335,9 @@ class ListValue : public Value { // Returns the number of Values in this list. size_t GetSize() const { return list_.size(); } + // Returns whether the list is empty. + bool empty() const { return list_.empty(); } + // Sets the list item at the given index to be the Value specified by // the value given. If the index beyond the current end of the list, null // Values will be used to pad out the list. |