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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 using ListStorage = std::vector<std::unique_ptr<Value>>; | 52 using ListStorage = std::vector<std::unique_ptr<Value>>; |
53 | 53 |
54 enum class Type { | 54 enum class Type { |
55 NONE = 0, | 55 NONE = 0, |
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 DELETED // TODO(crbug.com/697817): Remove after diagnosing the bug. |
63 // Note: Do not add more types. See the file-level comment above for why. | 64 // Note: Do not add more types. See the file-level comment above for why. |
64 }; | 65 }; |
65 | 66 |
66 static std::unique_ptr<Value> CreateNullValue(); | 67 static std::unique_ptr<Value> CreateNullValue(); |
67 | 68 |
68 // For situations where you want to keep ownership of your buffer, this | 69 // 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 | 70 // factory method creates a new BinaryValue by copying the contents of the |
70 // buffer that's passed in. | 71 // buffer that's passed in. |
71 // DEPRECATED, use MakeUnique<Value>(const std::vector<char>&) instead. | 72 // DEPRECATED, use MakeUnique<Value>(const std::vector<char>&) instead. |
72 // TODO(crbug.com/646113): Delete this and migrate callsites. | 73 // TODO(crbug.com/646113): Delete this and migrate callsites. |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 return out << static_cast<const Value&>(value); | 515 return out << static_cast<const Value&>(value); |
515 } | 516 } |
516 | 517 |
517 // Stream operator so that enum class Types can be used in log statements. | 518 // Stream operator so that enum class Types can be used in log statements. |
518 BASE_EXPORT std::ostream& operator<<(std::ostream& out, | 519 BASE_EXPORT std::ostream& operator<<(std::ostream& out, |
519 const Value::Type& type); | 520 const Value::Type& type); |
520 | 521 |
521 } // namespace base | 522 } // namespace base |
522 | 523 |
523 #endif // BASE_VALUES_H_ | 524 #endif // BASE_VALUES_H_ |
OLD | NEW |