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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 // Append a switch [with optional value] to the command line. | 116 // Append a switch [with optional value] to the command line. |
117 // Note: Switches will precede arguments regardless of appending order. | 117 // Note: Switches will precede arguments regardless of appending order. |
118 void AppendSwitch(const std::string& switch_string); | 118 void AppendSwitch(const std::string& switch_string); |
119 void AppendSwitchPath(const std::string& switch_string, | 119 void AppendSwitchPath(const std::string& switch_string, |
120 const base::FilePath& path); | 120 const base::FilePath& path); |
121 void AppendSwitchNative(const std::string& switch_string, | 121 void AppendSwitchNative(const std::string& switch_string, |
122 const StringType& value); | 122 const StringType& value); |
123 void AppendSwitchASCII(const std::string& switch_string, | 123 void AppendSwitchASCII(const std::string& switch_string, |
124 const std::string& value); | 124 const std::string& value); |
125 | 125 |
126 // Copy a set of switches (and any values) from another command line. | 126 // Copy a switch (and a value, if any) from another command line. |
127 void CopySwitchFrom(const CommandLine& source, | |
128 const char* switch_name); | |
129 | |
130 // Same as CopySwitchFrom, but for multiple switches. | |
127 // Commonly used when launching a subprocess. | 131 // Commonly used when launching a subprocess. |
128 void CopySwitchesFrom(const CommandLine& source, | 132 void CopySwitchesFrom(const CommandLine& source, |
brettw
2013/09/03 20:21:18
I don't think this is a very commonly used functio
| |
129 const char* const switches[], | 133 const char* const switches[], |
130 size_t count); | 134 size_t count); |
131 | 135 |
132 // Get the remaining arguments to the command. | 136 // Get the remaining arguments to the command. |
133 StringVector GetArgs() const; | 137 StringVector GetArgs() const; |
134 | 138 |
135 // Append an argument to the command line. Note that the argument is quoted | 139 // Append an argument to the command line. Note that the argument is quoted |
136 // properly such that it is interpreted as one argument to the target command. | 140 // properly such that it is interpreted as one argument to the target command. |
137 // AppendArg is primarily for ASCII; non-ASCII input is interpreted as UTF-8. | 141 // AppendArg is primarily for ASCII; non-ASCII input is interpreted as UTF-8. |
138 // Note: Switches will precede arguments regardless of appending order. | 142 // Note: Switches will precede arguments regardless of appending order. |
(...skipping 30 matching lines...) Expand all Loading... | |
169 StringVector argv_; | 173 StringVector argv_; |
170 | 174 |
171 // Parsed-out switch keys and values. | 175 // Parsed-out switch keys and values. |
172 SwitchMap switches_; | 176 SwitchMap switches_; |
173 | 177 |
174 // The index after the program and switches, any arguments start here. | 178 // The index after the program and switches, any arguments start here. |
175 size_t begin_args_; | 179 size_t begin_args_; |
176 }; | 180 }; |
177 | 181 |
178 #endif // BASE_COMMAND_LINE_H_ | 182 #endif // BASE_COMMAND_LINE_H_ |
OLD | NEW |