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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 | 659 |
660 void DictionaryValue::SetString(StringPiece path, const string16& in_value) { | 660 void DictionaryValue::SetString(StringPiece path, const string16& in_value) { |
661 Set(path, new Value(in_value)); | 661 Set(path, new Value(in_value)); |
662 } | 662 } |
663 | 663 |
664 void DictionaryValue::SetWithoutPathExpansion(StringPiece key, | 664 void DictionaryValue::SetWithoutPathExpansion(StringPiece key, |
665 std::unique_ptr<Value> in_value) { | 665 std::unique_ptr<Value> in_value) { |
666 (*dict_)[key.as_string()] = std::move(in_value); | 666 (*dict_)[key.as_string()] = std::move(in_value); |
667 } | 667 } |
668 | 668 |
669 void DictionaryValue::SetWithoutPathExpansion(StringPiece key, | |
670 Value* in_value) { | |
671 SetWithoutPathExpansion(key, WrapUnique(in_value)); | |
672 } | |
673 | |
674 void DictionaryValue::SetBooleanWithoutPathExpansion(StringPiece path, | 669 void DictionaryValue::SetBooleanWithoutPathExpansion(StringPiece path, |
675 bool in_value) { | 670 bool in_value) { |
676 SetWithoutPathExpansion(path, base::MakeUnique<base::Value>(in_value)); | 671 SetWithoutPathExpansion(path, base::MakeUnique<base::Value>(in_value)); |
677 } | 672 } |
678 | 673 |
679 void DictionaryValue::SetIntegerWithoutPathExpansion(StringPiece path, | 674 void DictionaryValue::SetIntegerWithoutPathExpansion(StringPiece path, |
680 int in_value) { | 675 int in_value) { |
681 SetWithoutPathExpansion(path, base::MakeUnique<base::Value>(in_value)); | 676 SetWithoutPathExpansion(path, base::MakeUnique<base::Value>(in_value)); |
682 } | 677 } |
683 | 678 |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 } | 1299 } |
1305 | 1300 |
1306 std::ostream& operator<<(std::ostream& out, const Value::Type& type) { | 1301 std::ostream& operator<<(std::ostream& out, const Value::Type& type) { |
1307 if (static_cast<int>(type) < 0 || | 1302 if (static_cast<int>(type) < 0 || |
1308 static_cast<size_t>(type) >= arraysize(kTypeNames)) | 1303 static_cast<size_t>(type) >= arraysize(kTypeNames)) |
1309 return out << "Invalid Type (index = " << static_cast<int>(type) << ")"; | 1304 return out << "Invalid Type (index = " << static_cast<int>(type) << ")"; |
1310 return out << Value::GetTypeName(type); | 1305 return out << Value::GetTypeName(type); |
1311 } | 1306 } |
1312 | 1307 |
1313 } // namespace base | 1308 } // namespace base |
OLD | NEW |