| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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_ |
| OLD | NEW |