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" |
11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 // 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 |
19 // 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 |
20 // expects |node| to always be non-NULL. | 20 // expects |node| to always be non-NULL. |
21 Value* CopyWithoutEmptyChildren(const Value* node) { | 21 Value* CopyWithoutEmptyChildren(const Value* node) { |
22 DCHECK(node); | 22 DCHECK(node); |
23 switch (node->GetType()) { | 23 switch (node->GetType()) { |
24 case Value::TYPE_LIST: { | 24 case Value::TYPE_LIST: { |
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 | 1110 |
1111 std::ostream& operator<<(std::ostream& out, const Value& value) { | 1111 std::ostream& operator<<(std::ostream& out, const Value& value) { |
1112 std::string json; | 1112 std::string json; |
1113 JSONWriter::WriteWithOptions(&value, | 1113 JSONWriter::WriteWithOptions(&value, |
1114 JSONWriter::OPTIONS_PRETTY_PRINT, | 1114 JSONWriter::OPTIONS_PRETTY_PRINT, |
1115 &json); | 1115 &json); |
1116 return out << json; | 1116 return out << json; |
1117 } | 1117 } |
1118 | 1118 |
1119 } // namespace base | 1119 } // namespace base |
OLD | NEW |