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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 } | 629 } |
630 | 630 |
631 current_dictionary = child_dictionary; | 631 current_dictionary = child_dictionary; |
632 current_path = current_path.substr(delimiter_position + 1); | 632 current_path = current_path.substr(delimiter_position + 1); |
633 } | 633 } |
634 | 634 |
635 return current_dictionary->SetWithoutPathExpansion(current_path, | 635 return current_dictionary->SetWithoutPathExpansion(current_path, |
636 std::move(in_value)); | 636 std::move(in_value)); |
637 } | 637 } |
638 | 638 |
639 Value* DictionaryValue::Set(StringPiece path, Value* in_value) { | |
640 return Set(path, WrapUnique(in_value)); | |
641 } | |
642 | |
643 Value* DictionaryValue::SetBoolean(StringPiece path, bool in_value) { | 639 Value* DictionaryValue::SetBoolean(StringPiece path, bool in_value) { |
644 return Set(path, MakeUnique<Value>(in_value)); | 640 return Set(path, MakeUnique<Value>(in_value)); |
645 } | 641 } |
646 | 642 |
647 Value* DictionaryValue::SetInteger(StringPiece path, int in_value) { | 643 Value* DictionaryValue::SetInteger(StringPiece path, int in_value) { |
648 return Set(path, MakeUnique<Value>(in_value)); | 644 return Set(path, MakeUnique<Value>(in_value)); |
649 } | 645 } |
650 | 646 |
651 Value* DictionaryValue::SetDouble(StringPiece path, double in_value) { | 647 Value* DictionaryValue::SetDouble(StringPiece path, double in_value) { |
652 return Set(path, MakeUnique<Value>(in_value)); | 648 return Set(path, MakeUnique<Value>(in_value)); |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 } | 1326 } |
1331 | 1327 |
1332 std::ostream& operator<<(std::ostream& out, const Value::Type& type) { | 1328 std::ostream& operator<<(std::ostream& out, const Value::Type& type) { |
1333 if (static_cast<int>(type) < 0 || | 1329 if (static_cast<int>(type) < 0 || |
1334 static_cast<size_t>(type) >= arraysize(kTypeNames)) | 1330 static_cast<size_t>(type) >= arraysize(kTypeNames)) |
1335 return out << "Invalid Type (index = " << static_cast<int>(type) << ")"; | 1331 return out << "Invalid Type (index = " << static_cast<int>(type) << ")"; |
1336 return out << Value::GetTypeName(type); | 1332 return out << Value::GetTypeName(type); |
1337 } | 1333 } |
1338 | 1334 |
1339 } // namespace base | 1335 } // namespace base |
OLD | NEW |