| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 | 9 |
| 10 #include "base/float_util.h" | 10 #include "base/float_util.h" |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 return true; | 626 return true; |
| 627 } | 627 } |
| 628 | 628 |
| 629 bool DictionaryValue::GetWithoutPathExpansion(const std::string& key, | 629 bool DictionaryValue::GetWithoutPathExpansion(const std::string& key, |
| 630 Value** out_value) { | 630 Value** out_value) { |
| 631 return static_cast<const DictionaryValue&>(*this).GetWithoutPathExpansion( | 631 return static_cast<const DictionaryValue&>(*this).GetWithoutPathExpansion( |
| 632 key, | 632 key, |
| 633 const_cast<const Value**>(out_value)); | 633 const_cast<const Value**>(out_value)); |
| 634 } | 634 } |
| 635 | 635 |
| 636 bool DictionaryValue::GetBooleanWithoutPathExpansion(const std::string& key, |
| 637 bool* out_value) const { |
| 638 const Value* value; |
| 639 if (!GetWithoutPathExpansion(key, &value)) |
| 640 return false; |
| 641 |
| 642 return value->GetAsBoolean(out_value); |
| 643 } |
| 644 |
| 636 bool DictionaryValue::GetIntegerWithoutPathExpansion(const std::string& key, | 645 bool DictionaryValue::GetIntegerWithoutPathExpansion(const std::string& key, |
| 637 int* out_value) const { | 646 int* out_value) const { |
| 638 const Value* value; | 647 const Value* value; |
| 639 if (!GetWithoutPathExpansion(key, &value)) | 648 if (!GetWithoutPathExpansion(key, &value)) |
| 640 return false; | 649 return false; |
| 641 | 650 |
| 642 return value->GetAsInteger(out_value); | 651 return value->GetAsInteger(out_value); |
| 643 } | 652 } |
| 644 | 653 |
| 645 bool DictionaryValue::GetDoubleWithoutPathExpansion(const std::string& key, | 654 bool DictionaryValue::GetDoubleWithoutPathExpansion(const std::string& key, |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 | 1129 |
| 1121 std::ostream& operator<<(std::ostream& out, const Value& value) { | 1130 std::ostream& operator<<(std::ostream& out, const Value& value) { |
| 1122 std::string json; | 1131 std::string json; |
| 1123 JSONWriter::WriteWithOptions(&value, | 1132 JSONWriter::WriteWithOptions(&value, |
| 1124 JSONWriter::OPTIONS_PRETTY_PRINT, | 1133 JSONWriter::OPTIONS_PRETTY_PRINT, |
| 1125 &json); | 1134 &json); |
| 1126 return out << json; | 1135 return out << json; |
| 1127 } | 1136 } |
| 1128 | 1137 |
| 1129 } // namespace base | 1138 } // namespace base |
| OLD | NEW |