| 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 considered "loose parameters". Switch names are | 8 // switch prefix are considered "loose parameters". Switch names are |
| 9 // case-insensitive. An argument of "--" will terminate switch | 9 // case-insensitive. An argument of "--" will terminate switch |
| 10 // parsing, causing everything after to be considered as loose | 10 // parsing, causing everything after to be considered as loose |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 #if defined(OS_WIN) | 141 #if defined(OS_WIN) |
| 142 // Returns the original command line string. | 142 // Returns the original command line string. |
| 143 const std::wstring& command_line_string() const { | 143 const std::wstring& command_line_string() const { |
| 144 return command_line_string_; | 144 return command_line_string_; |
| 145 } | 145 } |
| 146 #elif defined(OS_POSIX) | 146 #elif defined(OS_POSIX) |
| 147 // Returns the original command line string as a vector of strings. | 147 // Returns the original command line string as a vector of strings. |
| 148 const std::vector<std::string>& argv() const { | 148 const std::vector<std::string>& argv() const { |
| 149 return argv_; | 149 return argv_; |
| 150 } | 150 } |
| 151 // Try to match the same result as command_line_string() would get you |
| 152 // on windows. |
| 153 std::string command_line_string() const; |
| 151 #endif | 154 #endif |
| 152 | 155 |
| 153 // Returns the program part of the command line string (the first item). | 156 // Returns the program part of the command line string (the first item). |
| 154 FilePath GetProgram() const { | 157 FilePath GetProgram() const { |
| 155 return FilePath::FromWStringHack(program()); | 158 return FilePath::FromWStringHack(program()); |
| 156 } | 159 } |
| 157 | 160 |
| 158 // Returns the program part of the command line string (the first item). | 161 // Returns the program part of the command line string (the first item). |
| 159 // Deprecated version of the above. | 162 // Deprecated version of the above. |
| 160 std::wstring program() const; | 163 std::wstring program() const; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 std::vector<StringType> loose_values_; | 238 std::vector<StringType> loose_values_; |
| 236 | 239 |
| 237 // We allow copy constructors, because a common pattern is to grab a | 240 // We allow copy constructors, because a common pattern is to grab a |
| 238 // copy of the current process's command line and then add some | 241 // copy of the current process's command line and then add some |
| 239 // flags to it. E.g.: | 242 // flags to it. E.g.: |
| 240 // CommandLine cl(*CommandLine::ForCurrentProcess()); | 243 // CommandLine cl(*CommandLine::ForCurrentProcess()); |
| 241 // cl.AppendSwitch(...); | 244 // cl.AppendSwitch(...); |
| 242 }; | 245 }; |
| 243 | 246 |
| 244 #endif // BASE_COMMAND_LINE_H_ | 247 #endif // BASE_COMMAND_LINE_H_ |
| OLD | NEW |