Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 out.push_back('"'); | 144 out.push_back('"'); |
| 145 | 145 |
| 146 return out; | 146 return out; |
| 147 } | 147 } |
| 148 #endif | 148 #endif |
| 149 | 149 |
| 150 } // namespace | 150 } // namespace |
| 151 | 151 |
| 152 CommandLine::CommandLine(NoProgram no_program) | 152 CommandLine::CommandLine(NoProgram /* no_program */) |
|
danakj
2016/05/23 02:59:54
Just remove the name
https://google.github.io/sty
Luis Héctor Chávez
2016/05/24 15:27:52
Done.
| |
| 153 : argv_(1), | 153 : argv_(1), |
| 154 begin_args_(1) { | 154 begin_args_(1) { |
| 155 } | 155 } |
| 156 | 156 |
| 157 CommandLine::CommandLine(const FilePath& program) | 157 CommandLine::CommandLine(const FilePath& program) |
| 158 : argv_(1), | 158 : argv_(1), |
| 159 begin_args_(1) { | 159 begin_args_(1) { |
| 160 SetProgram(program); | 160 SetProgram(program); |
| 161 } | 161 } |
| 162 | 162 |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 437 StringType params(GetArgumentsStringInternal(quote_placeholders)); | 437 StringType params(GetArgumentsStringInternal(quote_placeholders)); |
| 438 if (!params.empty()) { | 438 if (!params.empty()) { |
| 439 string.append(StringType(FILE_PATH_LITERAL(" "))); | 439 string.append(StringType(FILE_PATH_LITERAL(" "))); |
| 440 string.append(params); | 440 string.append(params); |
| 441 } | 441 } |
| 442 return string; | 442 return string; |
| 443 } | 443 } |
| 444 | 444 |
| 445 CommandLine::StringType CommandLine::GetArgumentsStringInternal( | 445 CommandLine::StringType CommandLine::GetArgumentsStringInternal( |
| 446 bool quote_placeholders) const { | 446 bool quote_placeholders) const { |
| 447 #if !defined(OS_WIN) | |
| 448 // Avoid an unused warning. | |
| 449 (void)quote_placeholders; | |
| 450 #endif | |
| 447 StringType params; | 451 StringType params; |
| 448 // Append switches and arguments. | 452 // Append switches and arguments. |
| 449 bool parse_switches = true; | 453 bool parse_switches = true; |
| 450 for (size_t i = 1; i < argv_.size(); ++i) { | 454 for (size_t i = 1; i < argv_.size(); ++i) { |
| 451 StringType arg = argv_[i]; | 455 StringType arg = argv_[i]; |
| 452 StringType switch_string; | 456 StringType switch_string; |
| 453 StringType switch_value; | 457 StringType switch_value; |
| 454 parse_switches &= arg != kSwitchTerminator; | 458 parse_switches &= arg != kSwitchTerminator; |
| 455 if (i > 1) | 459 if (i > 1) |
| 456 params.append(StringType(FILE_PATH_LITERAL(" "))); | 460 params.append(StringType(FILE_PATH_LITERAL(" "))); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 473 return params; | 477 return params; |
| 474 } | 478 } |
| 475 | 479 |
| 476 void CommandLine::ResetStringPieces() { | 480 void CommandLine::ResetStringPieces() { |
| 477 switches_by_stringpiece_.clear(); | 481 switches_by_stringpiece_.clear(); |
| 478 for (const auto& entry : switches_) | 482 for (const auto& entry : switches_) |
| 479 switches_by_stringpiece_[entry.first] = &(entry.second); | 483 switches_by_stringpiece_[entry.first] = &(entry.second); |
| 480 } | 484 } |
| 481 | 485 |
| 482 } // namespace base | 486 } // namespace base |
| OLD | NEW |