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

Side by Side Diff: base/values.h

Issue 2792573002: Remove base::Value::CreateNullValue (Closed)
Patch Set: Rebase Created 3 years, 8 months 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
« no previous file with comments | « base/test/values_test_util.cc ('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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 BOOLEAN, 56 BOOLEAN,
57 INTEGER, 57 INTEGER,
58 DOUBLE, 58 DOUBLE,
59 STRING, 59 STRING,
60 BINARY, 60 BINARY,
61 DICTIONARY, 61 DICTIONARY,
62 LIST 62 LIST
63 // Note: Do not add more types. See the file-level comment above for why. 63 // Note: Do not add more types. See the file-level comment above for why.
64 }; 64 };
65 65
66 static std::unique_ptr<Value> CreateNullValue();
67
68 // For situations where you want to keep ownership of your buffer, this 66 // For situations where you want to keep ownership of your buffer, this
69 // factory method creates a new BinaryValue by copying the contents of the 67 // factory method creates a new BinaryValue by copying the contents of the
70 // buffer that's passed in. 68 // buffer that's passed in.
71 // DEPRECATED, use MakeUnique<Value>(const std::vector<char>&) instead. 69 // DEPRECATED, use MakeUnique<Value>(const std::vector<char>&) instead.
72 // TODO(crbug.com/646113): Delete this and migrate callsites. 70 // TODO(crbug.com/646113): Delete this and migrate callsites.
73 static std::unique_ptr<BinaryValue> CreateWithCopiedBuffer(const char* buffer, 71 static std::unique_ptr<BinaryValue> CreateWithCopiedBuffer(const char* buffer,
74 size_t size); 72 size_t size);
75 73
76 Value(const Value& that); 74 Value(const Value& that);
77 Value(Value&& that) noexcept; 75 Value(Value&& that) noexcept;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 BASE_EXPORT friend bool operator>(const Value& lhs, const Value& rhs); 169 BASE_EXPORT friend bool operator>(const Value& lhs, const Value& rhs);
172 BASE_EXPORT friend bool operator<=(const Value& lhs, const Value& rhs); 170 BASE_EXPORT friend bool operator<=(const Value& lhs, const Value& rhs);
173 BASE_EXPORT friend bool operator>=(const Value& lhs, const Value& rhs); 171 BASE_EXPORT friend bool operator>=(const Value& lhs, const Value& rhs);
174 172
175 // Compares if two Value objects have equal contents. 173 // Compares if two Value objects have equal contents.
176 // DEPRECATED, use operator==(const Value& lhs, const Value& rhs) instead. 174 // DEPRECATED, use operator==(const Value& lhs, const Value& rhs) instead.
177 // TODO(crbug.com/646113): Delete this and migrate callsites. 175 // TODO(crbug.com/646113): Delete this and migrate callsites.
178 bool Equals(const Value* other) const; 176 bool Equals(const Value* other) const;
179 177
180 // Compares if two Value objects have equal contents. Can handle NULLs. 178 // Compares if two Value objects have equal contents. Can handle NULLs.
181 // NULLs are considered equal but different from Value::CreateNullValue(). 179 // NULLs are considered equal but different from Value(Value::Type::NONE).
182 // DEPRECATED, use operator==(const Value& lhs, const Value& rhs) instead. 180 // DEPRECATED, use operator==(const Value& lhs, const Value& rhs) instead.
183 // TODO(crbug.com/646113): Delete this and migrate callsites. 181 // TODO(crbug.com/646113): Delete this and migrate callsites.
184 static bool Equals(const Value* a, const Value* b); 182 static bool Equals(const Value* a, const Value* b);
185 183
186 protected: 184 protected:
187 // TODO(crbug.com/646113): Make these private once DictionaryValue and 185 // TODO(crbug.com/646113): Make these private once DictionaryValue and
188 // ListValue are properly inlined. 186 // ListValue are properly inlined.
189 Type type_; 187 Type type_;
190 188
191 union { 189 union {
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 return out << static_cast<const Value&>(value); 530 return out << static_cast<const Value&>(value);
533 } 531 }
534 532
535 // Stream operator so that enum class Types can be used in log statements. 533 // Stream operator so that enum class Types can be used in log statements.
536 BASE_EXPORT std::ostream& operator<<(std::ostream& out, 534 BASE_EXPORT std::ostream& operator<<(std::ostream& out,
537 const Value::Type& type); 535 const Value::Type& type);
538 536
539 } // namespace base 537 } // namespace base
540 538
541 #endif // BASE_VALUES_H_ 539 #endif // BASE_VALUES_H_
OLDNEW
« no previous file with comments | « base/test/values_test_util.cc ('k') | base/values.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698