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

Side by Side Diff: tools/gn/command_args.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, 6 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 | « sync/util/get_session_name_mac.mm ('k') | tools/gn/filesystem_utils.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <stdio.h> 5 #include <stdio.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 19 matching lines...) Expand all
30 namespace commands { 30 namespace commands {
31 31
32 namespace { 32 namespace {
33 33
34 const char kSwitchList[] = "list"; 34 const char kSwitchList[] = "list";
35 const char kSwitchShort[] = "short"; 35 const char kSwitchShort[] = "short";
36 36
37 bool DoesLineBeginWithComment(const base::StringPiece& line) { 37 bool DoesLineBeginWithComment(const base::StringPiece& line) {
38 // Skip whitespace. 38 // Skip whitespace.
39 size_t i = 0; 39 size_t i = 0;
40 while (i < line.size() && IsAsciiWhitespace(line[i])) 40 while (i < line.size() && base::IsAsciiWhitespace(line[i]))
41 i++; 41 i++;
42 42
43 return i < line.size() && line[i] == '#'; 43 return i < line.size() && line[i] == '#';
44 } 44 }
45 45
46 // Returns the offset of the beginning of the line identified by |offset|. 46 // Returns the offset of the beginning of the line identified by |offset|.
47 size_t BackUpToLineBegin(const std::string& data, size_t offset) { 47 size_t BackUpToLineBegin(const std::string& data, size_t offset) {
48 // Degenerate case of an empty line. Below we'll try to return the 48 // Degenerate case of an empty line. Below we'll try to return the
49 // character after the newline, but that will be incorrect in this case. 49 // character after the newline, but that will be incorrect in this case.
50 if (offset == 0 || Tokenizer::IsNewline(data, offset)) 50 if (offset == 0 || Tokenizer::IsNewline(data, offset))
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 "Or see \"gn help args\" for more variants.").PrintToStdout(); 339 "Or see \"gn help args\" for more variants.").PrintToStdout();
340 return 1; 340 return 1;
341 } 341 }
342 342
343 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kSwitchList)) 343 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kSwitchList))
344 return ListArgs(args[0]); 344 return ListArgs(args[0]);
345 return EditArgsFile(args[0]); 345 return EditArgsFile(args[0]);
346 } 346 }
347 347
348 } // namespace commands 348 } // namespace commands
OLDNEW
« no previous file with comments | « sync/util/get_session_name_mac.mm ('k') | tools/gn/filesystem_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698