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

Side by Side Diff: base/strings/string_piece.cc

Issue 12982018: Move string_piece.h to base/strings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 9 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
« no previous file with comments | « base/strings/string_piece.h ('k') | base/strings/string_piece_unittest.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) 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 // Copied from strings/stringpiece.cc with modifications 4 // Copied from strings/stringpiece.cc with modifications
5 5
6 #include "base/strings/string_piece.h"
7
6 #include <algorithm> 8 #include <algorithm>
7 #include <ostream> 9 #include <ostream>
8 10
9 #include "base/string_piece.h"
10
11 namespace base { 11 namespace base {
12 12
13 // MSVC doesn't like complex extern templates and DLLs. 13 // MSVC doesn't like complex extern templates and DLLs.
14 #if !defined(COMPILER_MSVC) 14 #if !defined(COMPILER_MSVC)
15 namespace internal { 15 namespace internal {
16 template class StringPieceDetail<std::string>; 16 template class StringPieceDetail<std::string>;
17 template class StringPieceDetail<string16>; 17 template class StringPieceDetail<string16>;
18 } // namespace internal 18 } // namespace internal
19 19
20 template class BasicStringPiece<string16>; 20 template class BasicStringPiece<string16>;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 StringPiece substr(const StringPiece& self, 246 StringPiece substr(const StringPiece& self,
247 StringPiece::size_type pos, 247 StringPiece::size_type pos,
248 StringPiece::size_type n) { 248 StringPiece::size_type n) {
249 if (pos > self.size()) pos = self.size(); 249 if (pos > self.size()) pos = self.size();
250 if (n > self.size() - pos) n = self.size() - pos; 250 if (n > self.size() - pos) n = self.size() - pos;
251 return StringPiece(self.data() + pos, n); 251 return StringPiece(self.data() + pos, n);
252 } 252 }
253 253
254 } // namespace internal 254 } // namespace internal
255 } // namespace base 255 } // namespace base
OLDNEW
« no previous file with comments | « base/strings/string_piece.h ('k') | base/strings/string_piece_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698