| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // static | 78 // static |
| 79 std::unique_ptr<Value> Value::CreateWithCopiedBuffer(const char* buffer, | 79 std::unique_ptr<Value> Value::CreateWithCopiedBuffer(const char* buffer, |
| 80 size_t size) { | 80 size_t size) { |
| 81 return MakeUnique<Value>(std::vector<char>(buffer, buffer + size)); | 81 return MakeUnique<Value>(std::vector<char>(buffer, buffer + size)); |
| 82 } | 82 } |
| 83 | 83 |
| 84 Value::Value(const Value& that) { | 84 Value::Value(const Value& that) { |
| 85 InternalCopyConstructFrom(that); | 85 InternalCopyConstructFrom(that); |
| 86 } | 86 } |
| 87 | 87 |
| 88 Value::Value(Value&& that) noexcept { | 88 Value::Value(Value&& that) { |
| 89 InternalMoveConstructFrom(std::move(that)); | 89 InternalMoveConstructFrom(std::move(that)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 Value::Value() noexcept : type_(Type::NONE) {} | 92 Value::Value() noexcept : type_(Type::NONE) {} |
| 93 | 93 |
| 94 Value::Value(Type type) : type_(type) { | 94 Value::Value(Type type) : type_(type) { |
| 95 // Initialize with the default value. | 95 // Initialize with the default value. |
| 96 switch (type_) { | 96 switch (type_) { |
| 97 case Type::NONE: | 97 case Type::NONE: |
| 98 return; | 98 return; |
| (...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 } | 1323 } |
| 1324 | 1324 |
| 1325 std::ostream& operator<<(std::ostream& out, const Value::Type& type) { | 1325 std::ostream& operator<<(std::ostream& out, const Value::Type& type) { |
| 1326 if (static_cast<int>(type) < 0 || | 1326 if (static_cast<int>(type) < 0 || |
| 1327 static_cast<size_t>(type) >= arraysize(kTypeNames)) | 1327 static_cast<size_t>(type) >= arraysize(kTypeNames)) |
| 1328 return out << "Invalid Type (index = " << static_cast<int>(type) << ")"; | 1328 return out << "Invalid Type (index = " << static_cast<int>(type) << ")"; |
| 1329 return out << Value::GetTypeName(type); | 1329 return out << Value::GetTypeName(type); |
| 1330 } | 1330 } |
| 1331 | 1331 |
| 1332 } // namespace base | 1332 } // namespace base |
| OLD | NEW |