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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 // 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 |
67 // 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 |
68 // buffer that's passed in. | 68 // buffer that's passed in. |
69 // DEPRECATED, use MakeUnique<Value>(const std::vector<char>&) instead. | 69 // DEPRECATED, use MakeUnique<Value>(const std::vector<char>&) instead. |
70 // TODO(crbug.com/646113): Delete this and migrate callsites. | 70 // TODO(crbug.com/646113): Delete this and migrate callsites. |
71 static std::unique_ptr<Value> CreateWithCopiedBuffer(const char* buffer, | 71 static std::unique_ptr<Value> CreateWithCopiedBuffer(const char* buffer, |
72 size_t size); | 72 size_t size); |
73 | 73 |
74 Value(const Value& that); | 74 Value(const Value& that); |
75 Value(Value&& that) noexcept; | 75 Value(Value&& that); |
76 Value() noexcept; // A null value. | 76 Value() noexcept; // A null value. |
77 explicit Value(Type type); | 77 explicit Value(Type type); |
78 explicit Value(bool in_bool); | 78 explicit Value(bool in_bool); |
79 explicit Value(int in_int); | 79 explicit Value(int in_int); |
80 explicit Value(double in_double); | 80 explicit Value(double in_double); |
81 | 81 |
82 // Value(const char*) and Value(const char16*) are required despite | 82 // Value(const char*) and Value(const char16*) are required despite |
83 // Value(const std::string&) and Value(const string16&) because otherwise the | 83 // Value(const std::string&) and Value(const string16&) because otherwise the |
84 // compiler will choose the Value(bool) constructor for these arguments. | 84 // compiler will choose the Value(bool) constructor for these arguments. |
85 // Value(std::string&&) allow for efficient move construction. | 85 // Value(std::string&&) allow for efficient move construction. |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 return out << static_cast<const Value&>(value); | 538 return out << static_cast<const Value&>(value); |
539 } | 539 } |
540 | 540 |
541 // Stream operator so that enum class Types can be used in log statements. | 541 // Stream operator so that enum class Types can be used in log statements. |
542 BASE_EXPORT std::ostream& operator<<(std::ostream& out, | 542 BASE_EXPORT std::ostream& operator<<(std::ostream& out, |
543 const Value::Type& type); | 543 const Value::Type& type); |
544 | 544 |
545 } // namespace base | 545 } // namespace base |
546 | 546 |
547 #endif // BASE_VALUES_H_ | 547 #endif // BASE_VALUES_H_ |
OLD | NEW |