| 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 342 |
| 343 void CommandLine::AppendSwitchASCII(const std::string& switch_string, | 343 void CommandLine::AppendSwitchASCII(const std::string& switch_string, |
| 344 const std::string& value_string) { | 344 const std::string& value_string) { |
| 345 #if defined(OS_WIN) | 345 #if defined(OS_WIN) |
| 346 AppendSwitchNative(switch_string, ASCIIToWide(value_string)); | 346 AppendSwitchNative(switch_string, ASCIIToWide(value_string)); |
| 347 #elif defined(OS_POSIX) | 347 #elif defined(OS_POSIX) |
| 348 AppendSwitchNative(switch_string, value_string); | 348 AppendSwitchNative(switch_string, value_string); |
| 349 #endif | 349 #endif |
| 350 } | 350 } |
| 351 | 351 |
| 352 void CommandLine::CopySwitchFrom(const CommandLine& source, |
| 353 const char* switch_name) { |
| 354 CopySwitchesFrom(source, &switch_name, 1); |
| 355 } |
| 356 |
| 352 void CommandLine::CopySwitchesFrom(const CommandLine& source, | 357 void CommandLine::CopySwitchesFrom(const CommandLine& source, |
| 353 const char* const switches[], | 358 const char* const switches[], |
| 354 size_t count) { | 359 size_t count) { |
| 355 for (size_t i = 0; i < count; ++i) { | 360 for (size_t i = 0; i < count; ++i) { |
| 356 if (source.HasSwitch(switches[i])) | 361 if (source.HasSwitch(switches[i])) |
| 357 AppendSwitchNative(switches[i], source.GetSwitchValueNative(switches[i])); | 362 AppendSwitchNative(switches[i], source.GetSwitchValueNative(switches[i])); |
| 358 } | 363 } |
| 359 } | 364 } |
| 360 | 365 |
| 361 CommandLine::StringVector CommandLine::GetArgs() const { | 366 CommandLine::StringVector CommandLine::GetArgs() const { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 int num_args = 0; | 420 int num_args = 0; |
| 416 wchar_t** args = NULL; | 421 wchar_t** args = NULL; |
| 417 args = ::CommandLineToArgvW(command_line_string.c_str(), &num_args); | 422 args = ::CommandLineToArgvW(command_line_string.c_str(), &num_args); |
| 418 | 423 |
| 419 DPLOG_IF(FATAL, !args) << "CommandLineToArgvW failed on command line: " | 424 DPLOG_IF(FATAL, !args) << "CommandLineToArgvW failed on command line: " |
| 420 << command_line; | 425 << command_line; |
| 421 InitFromArgv(num_args, args); | 426 InitFromArgv(num_args, args); |
| 422 LocalFree(args); | 427 LocalFree(args); |
| 423 } | 428 } |
| 424 #endif | 429 #endif |
| OLD | NEW |