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 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 if (out_value) | 1227 if (out_value) |
1228 *out_value = MakeUnique<Value>(std::move(*iter)); | 1228 *out_value = MakeUnique<Value>(std::move(*iter)); |
1229 | 1229 |
1230 return list_->erase(iter); | 1230 return list_->erase(iter); |
1231 } | 1231 } |
1232 | 1232 |
1233 void ListValue::Append(std::unique_ptr<Value> in_value) { | 1233 void ListValue::Append(std::unique_ptr<Value> in_value) { |
1234 list_->push_back(std::move(*in_value)); | 1234 list_->push_back(std::move(*in_value)); |
1235 } | 1235 } |
1236 | 1236 |
1237 #if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | |
1238 void ListValue::Append(Value* in_value) { | |
1239 DCHECK(in_value); | |
1240 Append(WrapUnique(in_value)); | |
1241 } | |
1242 #endif | |
1243 | |
1244 void ListValue::AppendBoolean(bool in_value) { | 1237 void ListValue::AppendBoolean(bool in_value) { |
1245 Append(MakeUnique<Value>(in_value)); | 1238 Append(MakeUnique<Value>(in_value)); |
1246 } | 1239 } |
1247 | 1240 |
1248 void ListValue::AppendInteger(int in_value) { | 1241 void ListValue::AppendInteger(int in_value) { |
1249 Append(MakeUnique<Value>(in_value)); | 1242 Append(MakeUnique<Value>(in_value)); |
1250 } | 1243 } |
1251 | 1244 |
1252 void ListValue::AppendDouble(double in_value) { | 1245 void ListValue::AppendDouble(double in_value) { |
1253 Append(MakeUnique<Value>(in_value)); | 1246 Append(MakeUnique<Value>(in_value)); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 } | 1316 } |
1324 | 1317 |
1325 std::ostream& operator<<(std::ostream& out, const Value::Type& type) { | 1318 std::ostream& operator<<(std::ostream& out, const Value::Type& type) { |
1326 if (static_cast<int>(type) < 0 || | 1319 if (static_cast<int>(type) < 0 || |
1327 static_cast<size_t>(type) >= arraysize(kTypeNames)) | 1320 static_cast<size_t>(type) >= arraysize(kTypeNames)) |
1328 return out << "Invalid Type (index = " << static_cast<int>(type) << ")"; | 1321 return out << "Invalid Type (index = " << static_cast<int>(type) << ")"; |
1329 return out << Value::GetTypeName(type); | 1322 return out << Value::GetTypeName(type); |
1330 } | 1323 } |
1331 | 1324 |
1332 } // namespace base | 1325 } // namespace base |
OLD | NEW |