| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 #endif | 135 #endif |
| 136 | 136 |
| 137 // Returns the original command line string as a vector of strings. | 137 // Returns the original command line string as a vector of strings. |
| 138 const StringVector& argv() const { return argv_; } | 138 const StringVector& argv() const { return argv_; } |
| 139 | 139 |
| 140 // Get and Set the program part of the command line string (the first item). | 140 // Get and Set the program part of the command line string (the first item). |
| 141 FilePath GetProgram() const; | 141 FilePath GetProgram() const; |
| 142 void SetProgram(const FilePath& program); | 142 void SetProgram(const FilePath& program); |
| 143 | 143 |
| 144 // Returns true if this command line contains the given switch. | 144 // Returns true if this command line contains the given switch. |
| 145 // (Switch names are case-insensitive). | 145 // Switch names should only be lowercase. |
| 146 // The second override provides an optimized version to avoid inlining the | 146 // The second override provides an optimized version to avoid inlining the |
| 147 // codegen for the string allocation. | 147 // codegen for the string allocation. |
| 148 bool HasSwitch(const std::string& switch_string) const; | 148 bool HasSwitch(const std::string& switch_string) const; |
| 149 bool HasSwitch(const char switch_constant[]) const; | 149 bool HasSwitch(const char switch_constant[]) const; |
| 150 | 150 |
| 151 // Returns the value associated with the given switch. If the switch has no | 151 // Returns the value associated with the given switch. If the switch has no |
| 152 // value or isn't present, this method returns the empty string. | 152 // value or isn't present, this method returns the empty string. |
| 153 std::string GetSwitchValueASCII(const std::string& switch_string) const; | 153 std::string GetSwitchValueASCII(const std::string& switch_string) const; |
| 154 FilePath GetSwitchValuePath(const std::string& switch_string) const; | 154 FilePath GetSwitchValuePath(const std::string& switch_string) const; |
| 155 StringType GetSwitchValueNative(const std::string& switch_string) const; | 155 StringType GetSwitchValueNative(const std::string& switch_string) const; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // Parsed-out switch keys and values. | 223 // Parsed-out switch keys and values. |
| 224 SwitchMap switches_; | 224 SwitchMap switches_; |
| 225 | 225 |
| 226 // The index after the program and switches, any arguments start here. | 226 // The index after the program and switches, any arguments start here. |
| 227 size_t begin_args_; | 227 size_t begin_args_; |
| 228 }; | 228 }; |
| 229 | 229 |
| 230 } // namespace base | 230 } // namespace base |
| 231 | 231 |
| 232 #endif // BASE_COMMAND_LINE_H_ | 232 #endif // BASE_COMMAND_LINE_H_ |
| OLD | NEW |