OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 void AppendSwitchASCII(const std::string& switch_string, | 115 void AppendSwitchASCII(const std::string& switch_string, |
116 const std::string& value); | 116 const std::string& value); |
117 | 117 |
118 // Copy a set of switches (and any values) from another command line. | 118 // Copy a set of switches (and any values) from another command line. |
119 // Commonly used when launching a subprocess. | 119 // Commonly used when launching a subprocess. |
120 void CopySwitchesFrom(const CommandLine& source, | 120 void CopySwitchesFrom(const CommandLine& source, |
121 const char* const switches[], | 121 const char* const switches[], |
122 size_t count); | 122 size_t count); |
123 | 123 |
124 // Get the remaining arguments to the command. | 124 // Get the remaining arguments to the command. |
125 // TODO(msw): Rename GetArgs. | 125 StringVector GetArgs() const; |
126 StringVector args() const; | |
127 | 126 |
128 // Append an argument to the command line. Note that the argument is quoted | 127 // Append an argument to the command line. Note that the argument is quoted |
129 // properly such that it is interpreted as one argument to the target command. | 128 // properly such that it is interpreted as one argument to the target command. |
130 // AppendArg is primarily for ASCII; non-ASCII input is interpreted as UTF-8. | 129 // AppendArg is primarily for ASCII; non-ASCII input is interpreted as UTF-8. |
131 // Note: Switches will precede arguments regardless of appending order. | 130 // Note: Switches will precede arguments regardless of appending order. |
132 void AppendArg(const std::string& value); | 131 void AppendArg(const std::string& value); |
133 void AppendArgPath(const FilePath& value); | 132 void AppendArgPath(const FilePath& value); |
134 void AppendArgNative(const StringType& value); | 133 void AppendArgNative(const StringType& value); |
135 | 134 |
136 // Append the switches and arguments from another command line to this one. | 135 // Append the switches and arguments from another command line to this one. |
(...skipping 25 matching lines...) Expand all Loading... |
162 StringVector argv_; | 161 StringVector argv_; |
163 | 162 |
164 // Parsed-out switch keys and values. | 163 // Parsed-out switch keys and values. |
165 SwitchMap switches_; | 164 SwitchMap switches_; |
166 | 165 |
167 // The index after the program and switches, any arguments start here. | 166 // The index after the program and switches, any arguments start here. |
168 size_t begin_args_; | 167 size_t begin_args_; |
169 }; | 168 }; |
170 | 169 |
171 #endif // BASE_COMMAND_LINE_H_ | 170 #endif // BASE_COMMAND_LINE_H_ |
OLD | NEW |