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/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 if (include_program) | 387 if (include_program) |
388 SetProgram(other.GetProgram()); | 388 SetProgram(other.GetProgram()); |
389 AppendSwitchesAndArguments(this, other.argv()); | 389 AppendSwitchesAndArguments(this, other.argv()); |
390 } | 390 } |
391 | 391 |
392 void CommandLine::PrependWrapper(const CommandLine::StringType& wrapper) { | 392 void CommandLine::PrependWrapper(const CommandLine::StringType& wrapper) { |
393 if (wrapper.empty()) | 393 if (wrapper.empty()) |
394 return; | 394 return; |
395 // The wrapper may have embedded arguments (like "gdb --args"). In this case, | 395 // The wrapper may have embedded arguments (like "gdb --args"). In this case, |
396 // we don't pretend to do anything fancy, we just split on spaces. | 396 // we don't pretend to do anything fancy, we just split on spaces. |
397 StringVector wrapper_argv = SplitString( | 397 StringVector wrapper_argv; |
398 wrapper, FilePath::StringType(1, ' '), base::TRIM_WHITESPACE, | 398 SplitString(wrapper, FILE_PATH_LITERAL(' '), &wrapper_argv); |
399 base::SPLIT_WANT_ALL); | |
400 // Prepend the wrapper and update the switches/arguments |begin_args_|. | 399 // Prepend the wrapper and update the switches/arguments |begin_args_|. |
401 argv_.insert(argv_.begin(), wrapper_argv.begin(), wrapper_argv.end()); | 400 argv_.insert(argv_.begin(), wrapper_argv.begin(), wrapper_argv.end()); |
402 begin_args_ += wrapper_argv.size(); | 401 begin_args_ += wrapper_argv.size(); |
403 } | 402 } |
404 | 403 |
405 #if defined(OS_WIN) | 404 #if defined(OS_WIN) |
406 void CommandLine::ParseFromString(const string16& command_line) { | 405 void CommandLine::ParseFromString(const string16& command_line) { |
407 string16 command_line_string; | 406 string16 command_line_string; |
408 TrimWhitespace(command_line, TRIM_ALL, &command_line_string); | 407 TrimWhitespace(command_line, TRIM_ALL, &command_line_string); |
409 if (command_line_string.empty()) | 408 if (command_line_string.empty()) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 return params; | 464 return params; |
466 } | 465 } |
467 | 466 |
468 void CommandLine::ResetStringPieces() { | 467 void CommandLine::ResetStringPieces() { |
469 switches_by_stringpiece_.clear(); | 468 switches_by_stringpiece_.clear(); |
470 for (const auto& entry : switches_) | 469 for (const auto& entry : switches_) |
471 switches_by_stringpiece_[entry.first] = &(entry.second); | 470 switches_by_stringpiece_[entry.first] = &(entry.second); |
472 } | 471 } |
473 | 472 |
474 } // namespace base | 473 } // namespace base |
OLD | NEW |