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 void RemoveSwitchForTesting(const std::string& switch_string); | |
Ilya Sherman
2017/06/09 20:19:28
Please document this function.
| |
187 | |
186 // Copy a set of switches (and any values) from another command line. | 188 // Copy a set of switches (and any values) from another command line. |
187 // Commonly used when launching a subprocess. | 189 // Commonly used when launching a subprocess. |
188 void CopySwitchesFrom(const CommandLine& source, | 190 void CopySwitchesFrom(const CommandLine& source, |
189 const char* const switches[], | 191 const char* const switches[], |
190 size_t count); | 192 size_t count); |
191 | 193 |
192 // Get the remaining arguments to the command. | 194 // Get the remaining arguments to the command. |
193 StringVector GetArgs() const; | 195 StringVector GetArgs() const; |
194 | 196 |
195 // Append an argument to the command line. Note that the argument is quoted | 197 // 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. | 252 // Used for allocation-free lookups. |
251 StringPieceSwitchMap switches_by_stringpiece_; | 253 StringPieceSwitchMap switches_by_stringpiece_; |
252 | 254 |
253 // The index after the program and switches, any arguments start here. | 255 // The index after the program and switches, any arguments start here. |
254 size_t begin_args_; | 256 size_t begin_args_; |
255 }; | 257 }; |
256 | 258 |
257 } // namespace base | 259 } // namespace base |
258 | 260 |
259 #endif // BASE_COMMAND_LINE_H_ | 261 #endif // BASE_COMMAND_LINE_H_ |
OLD | NEW |