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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 | 175 |
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 void RemoveSwitchASCIIForTesting(const std::string& switch_string); | |
Ilya Sherman
2017/06/07 21:32:36
nit: Please separate this from the lines above wit
Ilya Sherman
2017/06/07 21:32:36
nit: Please drop "ASCII" from this name -- that re
| |
185 | 186 |
186 // Copy a set of switches (and any values) from another command line. | 187 // Copy a set of switches (and any values) from another command line. |
187 // Commonly used when launching a subprocess. | 188 // Commonly used when launching a subprocess. |
188 void CopySwitchesFrom(const CommandLine& source, | 189 void CopySwitchesFrom(const CommandLine& source, |
189 const char* const switches[], | 190 const char* const switches[], |
190 size_t count); | 191 size_t count); |
191 | 192 |
192 // Get the remaining arguments to the command. | 193 // Get the remaining arguments to the command. |
193 StringVector GetArgs() const; | 194 StringVector GetArgs() const; |
194 | 195 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 // Used for allocation-free lookups. | 251 // Used for allocation-free lookups. |
251 StringPieceSwitchMap switches_by_stringpiece_; | 252 StringPieceSwitchMap switches_by_stringpiece_; |
252 | 253 |
253 // The index after the program and switches, any arguments start here. | 254 // The index after the program and switches, any arguments start here. |
254 size_t begin_args_; | 255 size_t begin_args_; |
255 }; | 256 }; |
256 | 257 |
257 } // namespace base | 258 } // namespace base |
258 | 259 |
259 #endif // BASE_COMMAND_LINE_H_ | 260 #endif // BASE_COMMAND_LINE_H_ |
OLD | NEW |