| 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 #include "base/values.h" | 5 #include "base/values.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 ListValue* out; | 1052 ListValue* out; |
| 1053 if (value && value->GetAsList(&out)) { | 1053 if (value && value->GetAsList(&out)) { |
| 1054 ignore_result(value.release()); | 1054 ignore_result(value.release()); |
| 1055 return WrapUnique(out); | 1055 return WrapUnique(out); |
| 1056 } | 1056 } |
| 1057 return nullptr; | 1057 return nullptr; |
| 1058 } | 1058 } |
| 1059 | 1059 |
| 1060 ListValue::ListValue() : Value(Type::LIST) {} | 1060 ListValue::ListValue() : Value(Type::LIST) {} |
| 1061 | 1061 |
| 1062 ListValue::ListValue(const ListStorage& in_list) : Value(in_list) {} |
| 1063 |
| 1064 ListValue::ListValue(ListStorage&& in_list) noexcept |
| 1065 : Value(std::move(in_list)) {} |
| 1066 |
| 1062 void ListValue::Clear() { | 1067 void ListValue::Clear() { |
| 1063 list_->clear(); | 1068 list_->clear(); |
| 1064 } | 1069 } |
| 1065 | 1070 |
| 1066 void ListValue::Reserve(size_t n) { | 1071 void ListValue::Reserve(size_t n) { |
| 1067 list_->reserve(n); | 1072 list_->reserve(n); |
| 1068 } | 1073 } |
| 1069 | 1074 |
| 1070 bool ListValue::Set(size_t index, Value* in_value) { | 1075 bool ListValue::Set(size_t index, Value* in_value) { |
| 1071 return Set(index, WrapUnique(in_value)); | 1076 return Set(index, WrapUnique(in_value)); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 } | 1313 } |
| 1309 | 1314 |
| 1310 std::ostream& operator<<(std::ostream& out, const Value::Type& type) { | 1315 std::ostream& operator<<(std::ostream& out, const Value::Type& type) { |
| 1311 if (static_cast<int>(type) < 0 || | 1316 if (static_cast<int>(type) < 0 || |
| 1312 static_cast<size_t>(type) >= arraysize(kTypeNames)) | 1317 static_cast<size_t>(type) >= arraysize(kTypeNames)) |
| 1313 return out << "Invalid Type (index = " << static_cast<int>(type) << ")"; | 1318 return out << "Invalid Type (index = " << static_cast<int>(type) << ")"; |
| 1314 return out << Value::GetTypeName(type); | 1319 return out << Value::GetTypeName(type); |
| 1315 } | 1320 } |
| 1316 | 1321 |
| 1317 } // namespace base | 1322 } // namespace base |
| OLD | NEW |