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

Side by Side Diff: base/values.h

Issue 5213002: Fix for Bug 50726 "Save extension list and "winning" prefs from extensions" (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Same patch but without stuff that is already included in 5204006 Created 10 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 | « no previous file | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 virtual bool GetAsString(std::string* out_value) const; 93 virtual bool GetAsString(std::string* out_value) const;
94 virtual bool GetAsString(string16* out_value) const; 94 virtual bool GetAsString(string16* out_value) const;
95 95
96 // This creates a deep copy of the entire Value tree, and returns a pointer 96 // This creates a deep copy of the entire Value tree, and returns a pointer
97 // to the copy. The caller gets ownership of the copy, of course. 97 // to the copy. The caller gets ownership of the copy, of course.
98 virtual Value* DeepCopy() const; 98 virtual Value* DeepCopy() const;
99 99
100 // Compares if two Value objects have equal contents. 100 // Compares if two Value objects have equal contents.
101 virtual bool Equals(const Value* other) const; 101 virtual bool Equals(const Value* other) const;
102 102
103 // Compares if two Value objects have equal contents. Can handle NULLs.
104 // NULLs are considered equal but different from Value::CreateNullValue().
105 static bool Equals(const Value* a, const Value* b);
106
103 protected: 107 protected:
104 // This isn't safe for end-users (they should use the Create*Value() 108 // This isn't safe for end-users (they should use the Create*Value()
105 // static methods above), but it's useful for subclasses. 109 // static methods above), but it's useful for subclasses.
106 explicit Value(ValueType type); 110 explicit Value(ValueType type);
107 111
108 private: 112 private:
109 Value(); 113 Value();
110 114
111 ValueType type_; 115 ValueType type_;
112 116
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 // This method deserializes the subclass-specific format into a Value object. 456 // This method deserializes the subclass-specific format into a Value object.
453 // If the return value is non-NULL, the caller takes ownership of returned 457 // If the return value is non-NULL, the caller takes ownership of returned
454 // Value. If the return value is NULL, and if error_code is non-NULL, 458 // Value. If the return value is NULL, and if error_code is non-NULL,
455 // error_code will be set with the underlying error. 459 // error_code will be set with the underlying error.
456 // If |error_message| is non-null, it will be filled in with a formatted 460 // If |error_message| is non-null, it will be filled in with a formatted
457 // error message including the location of the error if appropriate. 461 // error message including the location of the error if appropriate.
458 virtual Value* Deserialize(int* error_code, std::string* error_str) = 0; 462 virtual Value* Deserialize(int* error_code, std::string* error_str) = 0;
459 }; 463 };
460 464
461 #endif // BASE_VALUES_H_ 465 #endif // BASE_VALUES_H_
OLDNEW
« no previous file with comments | « no previous file | base/values.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698