OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 327 |
328 void CommandLine::CopySwitchesFrom(const CommandLine& source, | 328 void CommandLine::CopySwitchesFrom(const CommandLine& source, |
329 const char* const switches[], | 329 const char* const switches[], |
330 size_t count) { | 330 size_t count) { |
331 for (size_t i = 0; i < count; ++i) { | 331 for (size_t i = 0; i < count; ++i) { |
332 if (source.HasSwitch(switches[i])) | 332 if (source.HasSwitch(switches[i])) |
333 AppendSwitchNative(switches[i], source.GetSwitchValueNative(switches[i])); | 333 AppendSwitchNative(switches[i], source.GetSwitchValueNative(switches[i])); |
334 } | 334 } |
335 } | 335 } |
336 | 336 |
337 CommandLine::StringVector CommandLine::args() const { | 337 CommandLine::StringVector CommandLine::GetArgs() const { |
338 // Gather all arguments after the last switch (may include kSwitchTerminator). | 338 // Gather all arguments after the last switch (may include kSwitchTerminator). |
339 StringVector args(argv_.begin() + begin_args_, argv_.end()); | 339 StringVector args(argv_.begin() + begin_args_, argv_.end()); |
340 // Erase only the first kSwitchTerminator (maybe "--" is a legitimate page?) | 340 // Erase only the first kSwitchTerminator (maybe "--" is a legitimate page?) |
341 StringVector::iterator switch_terminator = | 341 StringVector::iterator switch_terminator = |
342 std::find(args.begin(), args.end(), kSwitchTerminator); | 342 std::find(args.begin(), args.end(), kSwitchTerminator); |
343 if (switch_terminator != args.end()) | 343 if (switch_terminator != args.end()) |
344 args.erase(switch_terminator); | 344 args.erase(switch_terminator); |
345 return args; | 345 return args; |
346 } | 346 } |
347 | 347 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 int num_args = 0; | 391 int num_args = 0; |
392 wchar_t** args = NULL; | 392 wchar_t** args = NULL; |
393 args = ::CommandLineToArgvW(command_line_string.c_str(), &num_args); | 393 args = ::CommandLineToArgvW(command_line_string.c_str(), &num_args); |
394 | 394 |
395 PLOG_IF(FATAL, !args) << "CommandLineToArgvW failed on command line: " << | 395 PLOG_IF(FATAL, !args) << "CommandLineToArgvW failed on command line: " << |
396 command_line; | 396 command_line; |
397 InitFromArgv(num_args, args); | 397 InitFromArgv(num_args, args); |
398 LocalFree(args); | 398 LocalFree(args); |
399 } | 399 } |
400 #endif | 400 #endif |
OLD | NEW |