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

Side by Side Diff: base/string_util.cc

Issue 3448028: Implemented VLOG() et al. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Addressed evmar's comments Created 10 years, 2 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/string_util.h ('k') | base/vlog.h » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 4
5 #include "base/string_util.h" 5 #include "base/string_util.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include <ctype.h> 9 #include <ctype.h>
10 #include <errno.h> 10 #include <errno.h>
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 struct NextCharUTF16 { 1106 struct NextCharUTF16 {
1107 base_icu::UChar32 operator()(const char16** p, const char16* end) { 1107 base_icu::UChar32 operator()(const char16** p, const char16* end) {
1108 base_icu::UChar32 c; 1108 base_icu::UChar32 c;
1109 int offset = 0; 1109 int offset = 0;
1110 CBU16_NEXT(*p, offset, end - *p, c); 1110 CBU16_NEXT(*p, offset, end - *p, c);
1111 *p += offset; 1111 *p += offset;
1112 return c; 1112 return c;
1113 } 1113 }
1114 }; 1114 };
1115 1115
1116 bool MatchPattern(const std::string& eval, const std::string& pattern) { 1116 bool MatchPattern(const base::StringPiece& eval,
1117 return MatchPatternT(eval.c_str(), eval.c_str() + eval.size(), 1117 const base::StringPiece& pattern) {
1118 pattern.c_str(), pattern.c_str() + pattern.size(), 1118 return MatchPatternT(eval.data(), eval.data() + eval.size(),
1119 pattern.data(), pattern.data() + pattern.size(),
1119 0, NextCharUTF8()); 1120 0, NextCharUTF8());
1120 } 1121 }
1121 1122
1122 bool MatchPattern(const string16& eval, const string16& pattern) { 1123 bool MatchPattern(const string16& eval, const string16& pattern) {
1123 return MatchPatternT(eval.c_str(), eval.c_str() + eval.size(), 1124 return MatchPatternT(eval.c_str(), eval.c_str() + eval.size(),
1124 pattern.c_str(), pattern.c_str() + pattern.size(), 1125 pattern.c_str(), pattern.c_str() + pattern.size(),
1125 0, NextCharUTF16()); 1126 0, NextCharUTF16());
1126 } 1127 }
1127 1128
1128 // The following code is compatible with the OpenBSD lcpy interface. See: 1129 // The following code is compatible with the OpenBSD lcpy interface. See:
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 int rstr_len = (max_len - 3) / 2; 1186 int rstr_len = (max_len - 3) / 2;
1186 int lstr_len = rstr_len + ((max_len - 3) % 2); 1187 int lstr_len = rstr_len + ((max_len - 3) % 2);
1187 output->assign(input.substr(0, lstr_len) + L"..." + 1188 output->assign(input.substr(0, lstr_len) + L"..." +
1188 input.substr(input.length() - rstr_len)); 1189 input.substr(input.length() - rstr_len));
1189 break; 1190 break;
1190 } 1191 }
1191 } 1192 }
1192 1193
1193 return true; 1194 return true;
1194 } 1195 }
OLDNEW
« no previous file with comments | « base/string_util.h ('k') | base/vlog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698