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 // Switches can optionally have a value attached using an equals sign, | 6 // Switches can optionally have a value attached using an equals sign, |
7 // as in "-switch=value". Arguments that aren't prefixed with a | 7 // as in "-switch=value". Arguments that aren't prefixed with a |
8 // switch prefix are saved as extra arguments. An argument of "--" | 8 // switch prefix are saved as extra arguments. An argument of "--" |
9 // will terminate switch parsing, causing everything after to be | 9 // will terminate switch parsing, causing everything after to be |
10 // considered as extra arguments. | 10 // considered as extra arguments. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // Append a switch to the command line. | 128 // Append a switch to the command line. |
129 void AppendSwitch(const std::string& switch_string); | 129 void AppendSwitch(const std::string& switch_string); |
130 | 130 |
131 // Append a switch and value to the command line. | 131 // Append a switch and value to the command line. |
132 void AppendSwitchPath(const std::string& switch_string, const FilePath& path); | 132 void AppendSwitchPath(const std::string& switch_string, const FilePath& path); |
133 void AppendSwitchNative(const std::string& switch_string, | 133 void AppendSwitchNative(const std::string& switch_string, |
134 const StringType& value); | 134 const StringType& value); |
135 void AppendSwitchASCII(const std::string& switch_string, | 135 void AppendSwitchASCII(const std::string& switch_string, |
136 const std::string& value); | 136 const std::string& value); |
137 | 137 |
| 138 void AppendSwitches(const CommandLine& other); |
| 139 |
138 // Append an argument to the command line. | 140 // Append an argument to the command line. |
139 // Note on quoting: the argument will be quoted properly such that it is | 141 // Note on quoting: the argument will be quoted properly such that it is |
140 // interpreted as one argument to the target command. | 142 // interpreted as one argument to the target command. |
141 // AppendArg is primarily for ASCII; non-ASCII input will be | 143 // AppendArg is primarily for ASCII; non-ASCII input will be |
142 // interpreted as UTF-8. | 144 // interpreted as UTF-8. |
143 void AppendArg(const std::string& value); | 145 void AppendArg(const std::string& value); |
144 void AppendArgPath(const FilePath& value); | 146 void AppendArgPath(const FilePath& value); |
145 void AppendArgNative(const StringType& value); | 147 void AppendArgNative(const StringType& value); |
146 | 148 |
| 149 void AppendArgs(const CommandLine& other); |
| 150 |
147 // Append the arguments from another command line to this one. | 151 // Append the arguments from another command line to this one. |
148 // If |include_program| is true, include |other|'s program as well. | 152 // If |include_program| is true, include |other|'s program as well. |
149 void AppendArguments(const CommandLine& other, | 153 void AppendArguments(const CommandLine& other, |
150 bool include_program); | 154 bool include_program); |
151 | 155 |
152 // Insert a command before the current command. Common for debuggers, | 156 // Insert a command before the current command. Common for debuggers, |
153 // like "valgrind" or "gdb --args". | 157 // like "valgrind" or "gdb --args". |
154 void PrependWrapper(const StringType& wrapper); | 158 void PrependWrapper(const StringType& wrapper); |
155 | 159 |
156 // Copy a set of switches (and their values, if any) from another command | 160 // Copy a set of switches (and their values, if any) from another command |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 std::vector<StringType> args_; | 200 std::vector<StringType> args_; |
197 | 201 |
198 // We allow copy constructors, because a common pattern is to grab a | 202 // We allow copy constructors, because a common pattern is to grab a |
199 // copy of the current process's command line and then add some | 203 // copy of the current process's command line and then add some |
200 // flags to it. E.g.: | 204 // flags to it. E.g.: |
201 // CommandLine cl(*CommandLine::ForCurrentProcess()); | 205 // CommandLine cl(*CommandLine::ForCurrentProcess()); |
202 // cl.AppendSwitch(...); | 206 // cl.AppendSwitch(...); |
203 }; | 207 }; |
204 | 208 |
205 #endif // BASE_COMMAND_LINE_H_ | 209 #endif // BASE_COMMAND_LINE_H_ |
OLD | NEW |