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