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

Side by Side Diff: tools/gn/label_pattern.cc

Issue 1200053004: Move more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 | « tools/gn/label.cc ('k') | tools/gn/tokenizer.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "tools/gn/label_pattern.h" 5 #include "tools/gn/label_pattern.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "tools/gn/err.h" 8 #include "tools/gn/err.h"
9 #include "tools/gn/filesystem_utils.h" 9 #include "tools/gn/filesystem_utils.h"
10 #include "tools/gn/value.h" 10 #include "tools/gn/value.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 size_t offset = 0; 125 size_t offset = 0;
126 #if defined(OS_WIN) 126 #if defined(OS_WIN)
127 if (IsPathAbsolute(str)) { 127 if (IsPathAbsolute(str)) {
128 if (str[0] != '/') { 128 if (str[0] != '/') {
129 *err = Err(value, "Bad absolute path.", 129 *err = Err(value, "Bad absolute path.",
130 "Absolute paths must be of the form /C:\\ but this is \"" + 130 "Absolute paths must be of the form /C:\\ but this is \"" +
131 str.as_string() + "\"."); 131 str.as_string() + "\".");
132 return LabelPattern(); 132 return LabelPattern();
133 } 133 }
134 if (str.size() > 3 && str[2] == ':' && IsSlash(str[3]) && 134 if (str.size() > 3 && str[2] == ':' && IsSlash(str[3]) &&
135 IsAsciiAlpha(str[1])) { 135 base::IsAsciiAlpha(str[1])) {
136 // Skip over the drive letter colon. 136 // Skip over the drive letter colon.
137 offset = 3; 137 offset = 3;
138 } 138 }
139 } 139 }
140 #endif 140 #endif
141 size_t colon = str.find(':', offset); 141 size_t colon = str.find(':', offset);
142 if (colon == std::string::npos) { 142 if (colon == std::string::npos) {
143 path = base::StringPiece(str); 143 path = base::StringPiece(str);
144 } else { 144 } else {
145 path = str.substr(0, colon); 145 path = str.substr(0, colon);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 break; 257 break;
258 } 258 }
259 259
260 if (!toolchain_.is_null()) { 260 if (!toolchain_.is_null()) {
261 result.push_back('('); 261 result.push_back('(');
262 result.append(toolchain_.GetUserVisibleName(false)); 262 result.append(toolchain_.GetUserVisibleName(false));
263 result.push_back(')'); 263 result.push_back(')');
264 } 264 }
265 return result; 265 return result;
266 } 266 }
OLDNEW
« no previous file with comments | « tools/gn/label.cc ('k') | tools/gn/tokenizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698