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 // This class works with command lines: building and parsing. | 5 // This class works with command lines: building and parsing. |
6 // Arguments with prefixes ('--', '-', and on Windows, '/') are switches. | 6 // Arguments with prefixes ('--', '-', and on Windows, '/') are switches. |
7 // Switches will precede all other arguments without switch prefixes. | 7 // Switches will precede all other arguments without switch prefixes. |
8 // Switches can optionally have values, delimited by '=', e.g., "-switch=value". | 8 // Switches can optionally have values, delimited by '=', e.g., "-switch=value". |
9 // An argument of "--" will terminate switch parsing during initialization, | 9 // An argument of "--" will terminate switch parsing during initialization, |
10 // interpreting subsequent tokens as non-switch arguments, regardless of prefix. | 10 // interpreting subsequent tokens as non-switch arguments, regardless of prefix. |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // Append a switch [with optional value] to the command line. | 176 // Append a switch [with optional value] to the command line. |
177 // Note: Switches will precede arguments regardless of appending order. | 177 // Note: Switches will precede arguments regardless of appending order. |
178 void AppendSwitch(const std::string& switch_string); | 178 void AppendSwitch(const std::string& switch_string); |
179 void AppendSwitchPath(const std::string& switch_string, | 179 void AppendSwitchPath(const std::string& switch_string, |
180 const FilePath& path); | 180 const FilePath& path); |
181 void AppendSwitchNative(const std::string& switch_string, | 181 void AppendSwitchNative(const std::string& switch_string, |
182 const StringType& value); | 182 const StringType& value); |
183 void AppendSwitchASCII(const std::string& switch_string, | 183 void AppendSwitchASCII(const std::string& switch_string, |
184 const std::string& value); | 184 const std::string& value); |
185 | 185 |
| 186 // Remove given switch from CommandLine. |
| 187 void RemoveSwitchForTesting(const std::string& switch_string); |
| 188 |
186 // Copy a set of switches (and any values) from another command line. | 189 // Copy a set of switches (and any values) from another command line. |
187 // Commonly used when launching a subprocess. | 190 // Commonly used when launching a subprocess. |
188 void CopySwitchesFrom(const CommandLine& source, | 191 void CopySwitchesFrom(const CommandLine& source, |
189 const char* const switches[], | 192 const char* const switches[], |
190 size_t count); | 193 size_t count); |
191 | 194 |
192 // Get the remaining arguments to the command. | 195 // Get the remaining arguments to the command. |
193 StringVector GetArgs() const; | 196 StringVector GetArgs() const; |
194 | 197 |
195 // Append an argument to the command line. Note that the argument is quoted | 198 // Append an argument to the command line. Note that the argument is quoted |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 // Used for allocation-free lookups. | 253 // Used for allocation-free lookups. |
251 StringPieceSwitchMap switches_by_stringpiece_; | 254 StringPieceSwitchMap switches_by_stringpiece_; |
252 | 255 |
253 // The index after the program and switches, any arguments start here. | 256 // The index after the program and switches, any arguments start here. |
254 size_t begin_args_; | 257 size_t begin_args_; |
255 }; | 258 }; |
256 | 259 |
257 } // namespace base | 260 } // namespace base |
258 | 261 |
259 #endif // BASE_COMMAND_LINE_H_ | 262 #endif // BASE_COMMAND_LINE_H_ |
OLD | NEW |