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

Unified Diff: base/string_piece.cc

Issue 9159005: Move operator<< for StringPiece into string_piece.{h,cc} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix license Created 8 years, 11 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/string_piece.h ('k') | chrome/renderer/extensions/chrome_v8_extension.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/string_piece.cc
diff --git a/base/string_piece.cc b/base/string_piece.cc
index 27f00136c2e3414fbd12342604d68dc0526ffa5e..7a41361bb606b9e8fb6e796b19cba8ca84d4656e 100644
--- a/base/string_piece.cc
+++ b/base/string_piece.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Copied from strings/stringpiece.cc with modifications
@@ -27,6 +27,11 @@ bool operator==(const StringPiece& x, const StringPiece& y) {
return StringPiece::wordmemcmp(x.data(), y.data(), x.size()) == 0;
}
+std::ostream& operator<<(std::ostream& o, const StringPiece& piece) {
+ o.write(piece.data(), static_cast<std::streamsize>(piece.size()));
+ return o;
+}
+
namespace internal {
void CopyToString(const StringPiece& self, std::string* target) {
target->assign(!self.empty() ? self.data() : "", self.size());
« no previous file with comments | « base/string_piece.h ('k') | chrome/renderer/extensions/chrome_v8_extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698