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

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: . 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..346f039139096fce786c0e32ac8f46880eb031bb 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;
+ base::JSONWriter::WriteWithOptions(&value,
willchan no longer on Chromium 2012/09/12 01:20:13 is the base:: here necessary? We're in the base na
not at google - send to devlin 2012/09/12 01:21:48 Done.
+ 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