Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2559)

Unified Diff: base/values.cc

Issue 10915194: Add an ostream operator to Value (based on JSONWriter) so that assertions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove base:: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/values.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/values.cc
diff --git a/base/values.cc b/base/values.cc
index c9b5eef3da7052d8b05e086656bcc539026f91c4..1063effe3778d9dc644ab5750f4e47fa41f9e77c 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -5,8 +5,10 @@
#include "base/values.h"
#include <algorithm>
+#include <ostream>
#include "base/float_util.h"
+#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -1057,4 +1059,12 @@ bool ListValue::Equals(const Value* other) const {
ValueSerializer::~ValueSerializer() {
}
+std::ostream& operator<<(std::ostream& out, const Value& value) {
+ std::string json;
+ JSONWriter::WriteWithOptions(&value,
+ JSONWriter::OPTIONS_PRETTY_PRINT,
+ &json);
+ return out << json;
+}
+
} // namespace base
« no previous file with comments | « base/values.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698