| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 const size_t equals_position = string.find(kSwitchValueSeparator); | 65 const size_t equals_position = string.find(kSwitchValueSeparator); |
| 66 *switch_string = string.substr(0, equals_position); | 66 *switch_string = string.substr(0, equals_position); |
| 67 if (equals_position != CommandLine::StringType::npos) | 67 if (equals_position != CommandLine::StringType::npos) |
| 68 *switch_value = string.substr(equals_position + 1); | 68 *switch_value = string.substr(equals_position + 1); |
| 69 return true; | 69 return true; |
| 70 } | 70 } |
| 71 | 71 |
| 72 // Append switches and arguments, keeping switches before arguments. | 72 // Append switches and arguments, keeping switches before arguments. |
| 73 void AppendSwitchesAndArguments(CommandLine* command_line, | 73 void AppendSwitchesAndArguments(CommandLine* command_line, |
| 74 const CommandLine::StringVector& argv) { | 74 const CommandLine::StringVector& argv) { |
| 75 LOG(ERROR) << "auraclank: CommandLine::AppendArguments:"; |
| 75 bool parse_switches = true; | 76 bool parse_switches = true; |
| 76 for (size_t i = 1; i < argv.size(); ++i) { | 77 for (size_t i = 1; i < argv.size(); ++i) { |
| 77 CommandLine::StringType arg = argv[i]; | 78 CommandLine::StringType arg = argv[i]; |
| 78 TrimWhitespace(arg, TRIM_ALL, &arg); | 79 TrimWhitespace(arg, TRIM_ALL, &arg); |
| 80 LOG(ERROR) << arg; |
| 79 | 81 |
| 80 CommandLine::StringType switch_string; | 82 CommandLine::StringType switch_string; |
| 81 CommandLine::StringType switch_value; | 83 CommandLine::StringType switch_value; |
| 82 parse_switches &= (arg != kSwitchTerminator); | 84 parse_switches &= (arg != kSwitchTerminator); |
| 83 if (parse_switches && IsSwitch(arg, &switch_string, &switch_value)) { | 85 if (parse_switches && IsSwitch(arg, &switch_string, &switch_value)) { |
| 84 #if defined(OS_WIN) | 86 #if defined(OS_WIN) |
| 85 command_line->AppendSwitchNative(UTF16ToASCII(switch_string), | 87 command_line->AppendSwitchNative(UTF16ToASCII(switch_string), |
| 86 switch_value); | 88 switch_value); |
| 87 #elif defined(OS_POSIX) | 89 #elif defined(OS_POSIX) |
| 88 command_line->AppendSwitchNative(switch_string, switch_value); | 90 command_line->AppendSwitchNative(switch_string, switch_value); |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 return params; | 467 return params; |
| 466 } | 468 } |
| 467 | 469 |
| 468 void CommandLine::ResetStringPieces() { | 470 void CommandLine::ResetStringPieces() { |
| 469 switches_by_stringpiece_.clear(); | 471 switches_by_stringpiece_.clear(); |
| 470 for (const auto& entry : switches_) | 472 for (const auto& entry : switches_) |
| 471 switches_by_stringpiece_[entry.first] = &(entry.second); | 473 switches_by_stringpiece_[entry.first] = &(entry.second); |
| 472 } | 474 } |
| 473 | 475 |
| 474 } // namespace base | 476 } // namespace base |
| OLD | NEW |