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

Side by Side Diff: base/string_piece.cc

Issue 6410105: run iwyu on base! Base URL: svn://svn.chromium.org/chrome/trunk/src/base
Patch Set: Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/string_number_conversions.cc ('k') | base/string_split.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // Copied from strings/stringpiece.cc with modifications 4 // Copied from strings/stringpiece.cc with modifications
5 5
6 #include <limits.h>
7 #include <stddef.h>
8 #include <string.h>
6 #include <algorithm> 9 #include <algorithm>
7 #include <ostream> 10 #include <ostream>
11 #include <string>
8 12
9 #include "base/string_piece.h" 13 #include "base/string_piece.h"
10 14
11 namespace base { 15 namespace base {
12 16
13 typedef StringPiece::size_type size_type; 17 typedef StringPiece::size_type size_type;
14 18
15 std::ostream& operator<<(std::ostream& o, const StringPiece& piece) { 19 std::ostream& operator<<(std::ostream& o, const StringPiece& piece) {
16 o.write(piece.data(), static_cast<std::streamsize>(piece.size())); 20 o.write(piece.data(), static_cast<std::streamsize>(piece.size()));
17 return o; 21 return o;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 214
211 StringPiece StringPiece::substr(size_type pos, size_type n) const { 215 StringPiece StringPiece::substr(size_type pos, size_type n) const {
212 if (pos > length_) pos = length_; 216 if (pos > length_) pos = length_;
213 if (n > length_ - pos) n = length_ - pos; 217 if (n > length_ - pos) n = length_ - pos;
214 return StringPiece(ptr_ + pos, n); 218 return StringPiece(ptr_ + pos, n);
215 } 219 }
216 220
217 const StringPiece::size_type StringPiece::npos = size_type(-1); 221 const StringPiece::size_type StringPiece::npos = size_type(-1);
218 222
219 } // namespace base 223 } // namespace base
OLDNEW
« no previous file with comments | « base/string_number_conversions.cc ('k') | base/string_split.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698