| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 return node->DeepCopy(); | 61 return node->DeepCopy(); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 // A small functor for comparing Values for std::find_if and similar. | 65 // A small functor for comparing Values for std::find_if and similar. |
| 66 class ValueEquals { | 66 class ValueEquals { |
| 67 public: | 67 public: |
| 68 // Pass the value against which all consecutive calls of the () operator will | 68 // Pass the value against which all consecutive calls of the () operator will |
| 69 // compare their argument to. This Value object must not be destroyed while | 69 // compare their argument to. This Value object must not be destroyed while |
| 70 // the ValueEquals is in use. | 70 // the ValueEquals is in use. |
| 71 ValueEquals(const Value* first) : first_(first) { } | 71 explicit ValueEquals(const Value* first) : first_(first) { } |
| 72 | 72 |
| 73 bool operator ()(const Value* second) const { | 73 bool operator ()(const Value* second) const { |
| 74 return first_->Equals(second); | 74 return first_->Equals(second); |
| 75 } | 75 } |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 const Value* first_; | 78 const Value* first_; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 } // namespace | 81 } // namespace |
| (...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 | 1135 |
| 1136 std::ostream& operator<<(std::ostream& out, const Value& value) { | 1136 std::ostream& operator<<(std::ostream& out, const Value& value) { |
| 1137 std::string json; | 1137 std::string json; |
| 1138 JSONWriter::WriteWithOptions(&value, | 1138 JSONWriter::WriteWithOptions(&value, |
| 1139 JSONWriter::OPTIONS_PRETTY_PRINT, | 1139 JSONWriter::OPTIONS_PRETTY_PRINT, |
| 1140 &json); | 1140 &json); |
| 1141 return out << json; | 1141 return out << json; |
| 1142 } | 1142 } |
| 1143 | 1143 |
| 1144 } // namespace base | 1144 } // namespace base |
| OLD | NEW |