| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // This class works with command lines: building and parsing. | 5 // This class works with command lines: building and parsing. |
| 6 // Switches can optionally have a value attached using an equals sign, | 6 // Switches can optionally have a value attached using an equals sign, |
| 7 // as in "-switch=value". Arguments that aren't prefixed with a | 7 // as in "-switch=value". Arguments that aren't prefixed with a |
| 8 // switch prefix are saved as extra arguments. An argument of "--" | 8 // switch prefix are saved as extra arguments. An argument of "--" |
| 9 // will terminate switch parsing, causing everything after to be | 9 // will terminate switch parsing, causing everything after to be |
| 10 // considered as extra arguments. | 10 // considered as extra arguments. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include <string> | 23 #include <string> |
| 24 #include <vector> | 24 #include <vector> |
| 25 | 25 |
| 26 #include "base/basictypes.h" | 26 #include "base/basictypes.h" |
| 27 | 27 |
| 28 class FilePath; | 28 class FilePath; |
| 29 class InProcessBrowserTest; | 29 class InProcessBrowserTest; |
| 30 | 30 |
| 31 class CommandLine { | 31 class CommandLine { |
| 32 public: | 32 public: |
| 33 // A constructor for CommandLines that are used only to carry arguments. | 33 // A constructor for CommandLines that are used only to carry switches and |
| 34 enum ArgumentsOnly { ARGUMENTS_ONLY }; | 34 // arguments. |
| 35 explicit CommandLine(ArgumentsOnly args_only); | 35 enum NoProgram { NO_PROGRAM }; |
| 36 explicit CommandLine(NoProgram no_program); |
| 36 ~CommandLine(); | 37 ~CommandLine(); |
| 37 | 38 |
| 38 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
| 39 // The type of native command line arguments. | 40 // The type of native command line arguments. |
| 40 typedef std::wstring StringType; | 41 typedef std::wstring StringType; |
| 41 | 42 |
| 42 // Initialize by parsing the given command-line string. | 43 // Initialize by parsing the given command-line string. |
| 43 // The program name is assumed to be the first item in the string. | 44 // The program name is assumed to be the first item in the string. |
| 44 void ParseFromString(const std::wstring& command_line); | 45 void ParseFromString(const std::wstring& command_line); |
| 45 static CommandLine FromString(const std::wstring& command_line); | 46 static CommandLine FromString(const std::wstring& command_line); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 std::vector<StringType> args_; | 206 std::vector<StringType> args_; |
| 206 | 207 |
| 207 // We allow copy constructors, because a common pattern is to grab a | 208 // We allow copy constructors, because a common pattern is to grab a |
| 208 // copy of the current process's command line and then add some | 209 // copy of the current process's command line and then add some |
| 209 // flags to it. E.g.: | 210 // flags to it. E.g.: |
| 210 // CommandLine cl(*CommandLine::ForCurrentProcess()); | 211 // CommandLine cl(*CommandLine::ForCurrentProcess()); |
| 211 // cl.AppendSwitch(...); | 212 // cl.AppendSwitch(...); |
| 212 }; | 213 }; |
| 213 | 214 |
| 214 #endif // BASE_COMMAND_LINE_H_ | 215 #endif // BASE_COMMAND_LINE_H_ |
| OLD | NEW |