| 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 | 9 |
| 9 #include "base/float_util.h" | 10 #include "base/float_util.h" |
| 11 #include "base/json/json_writer.h" |
| 10 #include "base/logging.h" | 12 #include "base/logging.h" |
| 11 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 12 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 13 | 15 |
| 14 namespace { | 16 namespace { |
| 15 | 17 |
| 16 // Make a deep copy of |node|, but don't include empty lists or dictionaries | 18 // Make a deep copy of |node|, but don't include empty lists or dictionaries |
| 17 // in the copy. It's possible for this function to return NULL and it | 19 // in the copy. It's possible for this function to return NULL and it |
| 18 // expects |node| to always be non-NULL. | 20 // expects |node| to always be non-NULL. |
| 19 Value* CopyWithoutEmptyChildren(Value* node) { | 21 Value* CopyWithoutEmptyChildren(Value* node) { |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 } | 1052 } |
| 1051 if (lhs_it != end() || rhs_it != other_list->end()) | 1053 if (lhs_it != end() || rhs_it != other_list->end()) |
| 1052 return false; | 1054 return false; |
| 1053 | 1055 |
| 1054 return true; | 1056 return true; |
| 1055 } | 1057 } |
| 1056 | 1058 |
| 1057 ValueSerializer::~ValueSerializer() { | 1059 ValueSerializer::~ValueSerializer() { |
| 1058 } | 1060 } |
| 1059 | 1061 |
| 1062 std::ostream& operator<<(std::ostream& out, const Value& value) { |
| 1063 std::string json; |
| 1064 JSONWriter::WriteWithOptions(&value, |
| 1065 JSONWriter::OPTIONS_PRETTY_PRINT, |
| 1066 &json); |
| 1067 return out << json; |
| 1068 } |
| 1069 |
| 1060 } // namespace base | 1070 } // namespace base |
| OLD | NEW |