Chromium Code Reviews| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 Value::Value(const char16* in_string) : type_(Type::STRING) { | 152 Value::Value(const char16* in_string) : type_(Type::STRING) { |
| 153 string_value_.Init(UTF16ToUTF8(in_string)); | 153 string_value_.Init(UTF16ToUTF8(in_string)); |
| 154 } | 154 } |
| 155 | 155 |
| 156 Value::Value(const string16& in_string) : type_(Type::STRING) { | 156 Value::Value(const string16& in_string) : type_(Type::STRING) { |
| 157 string_value_.Init(UTF16ToUTF8(in_string)); | 157 string_value_.Init(UTF16ToUTF8(in_string)); |
| 158 } | 158 } |
| 159 | 159 |
| 160 Value::Value(StringPiece in_string) : Value(in_string.as_string()) {} | 160 Value::Value(StringPiece in_string) : Value(in_string.as_string()) {} |
| 161 | 161 |
| 162 Value::Value(DictStorage&& in_dict) noexcept : type_(Type::DICTIONARY) { | |
|
jdoerrie
2017/04/10 11:44:57
Same here.
| |
| 163 dict_ptr_.Init(MakeUnique<DictStorage>(std::move(in_dict))); | |
| 164 } | |
| 165 | |
| 162 Value::Value(const std::vector<char>& in_blob) : type_(Type::BINARY) { | 166 Value::Value(const std::vector<char>& in_blob) : type_(Type::BINARY) { |
| 163 binary_value_.Init(in_blob); | 167 binary_value_.Init(in_blob); |
| 164 } | 168 } |
| 165 | 169 |
| 166 Value::Value(std::vector<char>&& in_blob) noexcept : type_(Type::BINARY) { | 170 Value::Value(std::vector<char>&& in_blob) noexcept : type_(Type::BINARY) { |
| 167 binary_value_.Init(std::move(in_blob)); | 171 binary_value_.Init(std::move(in_blob)); |
| 168 } | 172 } |
| 169 | 173 |
| 170 Value& Value::operator=(const Value& that) { | 174 Value& Value::operator=(const Value& that) { |
| 171 if (type_ == that.type_) { | 175 if (type_ == that.type_) { |
| (...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1337 } | 1341 } |
| 1338 | 1342 |
| 1339 std::ostream& operator<<(std::ostream& out, const Value::Type& type) { | 1343 std::ostream& operator<<(std::ostream& out, const Value::Type& type) { |
| 1340 if (static_cast<int>(type) < 0 || | 1344 if (static_cast<int>(type) < 0 || |
| 1341 static_cast<size_t>(type) >= arraysize(kTypeNames)) | 1345 static_cast<size_t>(type) >= arraysize(kTypeNames)) |
| 1342 return out << "Invalid Type (index = " << static_cast<int>(type) << ")"; | 1346 return out << "Invalid Type (index = " << static_cast<int>(type) << ")"; |
| 1343 return out << Value::GetTypeName(type); | 1347 return out << Value::GetTypeName(type); |
| 1344 } | 1348 } |
| 1345 | 1349 |
| 1346 } // namespace base | 1350 } // namespace base |
| OLD | NEW |