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

Side by Side Diff: base/values.h

Issue 2740373002: Cleaning up base::Value assignment. (Closed)
Patch Set: Rebase. Created 3 years, 9 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 | « 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) 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // on the heap results in sizeof(Value) = 40 for all of gcc, clang and MSVC. 187 // on the heap results in sizeof(Value) = 40 for all of gcc, clang and MSVC.
188 ManualConstructor<std::unique_ptr<DictStorage>> dict_ptr_; 188 ManualConstructor<std::unique_ptr<DictStorage>> dict_ptr_;
189 ManualConstructor<ListStorage> list_; 189 ManualConstructor<ListStorage> list_;
190 }; 190 };
191 191
192 private: 192 private:
193 void InternalCopyFundamentalValue(const Value& that); 193 void InternalCopyFundamentalValue(const Value& that);
194 void InternalCopyConstructFrom(const Value& that); 194 void InternalCopyConstructFrom(const Value& that);
195 void InternalMoveConstructFrom(Value&& that); 195 void InternalMoveConstructFrom(Value&& that);
196 void InternalCopyAssignFromSameType(const Value& that); 196 void InternalCopyAssignFromSameType(const Value& that);
197 void InternalMoveAssignFromSameType(Value&& that);
198 void InternalCleanup(); 197 void InternalCleanup();
199 }; 198 };
200 199
201 // DictionaryValue provides a key-value dictionary with (optional) "path" 200 // DictionaryValue provides a key-value dictionary with (optional) "path"
202 // parsing for recursive access; see the comment at the top of the file. Keys 201 // parsing for recursive access; see the comment at the top of the file. Keys
203 // are |std::string|s and should be UTF-8 encoded. 202 // are |std::string|s and should be UTF-8 encoded.
204 class BASE_EXPORT DictionaryValue : public Value { 203 class BASE_EXPORT DictionaryValue : public Value {
205 public: 204 public:
206 // Returns |value| if it is a dictionary, nullptr otherwise. 205 // Returns |value| if it is a dictionary, nullptr otherwise.
207 static std::unique_ptr<DictionaryValue> From(std::unique_ptr<Value> value); 206 static std::unique_ptr<DictionaryValue> From(std::unique_ptr<Value> value);
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 return out << static_cast<const Value&>(value); 516 return out << static_cast<const Value&>(value);
518 } 517 }
519 518
520 // Stream operator so that enum class Types can be used in log statements. 519 // Stream operator so that enum class Types can be used in log statements.
521 BASE_EXPORT std::ostream& operator<<(std::ostream& out, 520 BASE_EXPORT std::ostream& operator<<(std::ostream& out,
522 const Value::Type& type); 521 const Value::Type& type);
523 522
524 } // namespace base 523 } // namespace base
525 524
526 #endif // BASE_VALUES_H_ 525 #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