Chromium Code Reviews| 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 16 matching lines...) Expand all Loading... | |
| 27 | 27 |
| 28 namespace base { | 28 namespace base { |
| 29 | 29 |
| 30 class FilePath; | 30 class FilePath; |
| 31 | 31 |
| 32 class BASE_EXPORT CommandLine { | 32 class BASE_EXPORT CommandLine { |
| 33 public: | 33 public: |
| 34 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
| 35 // The native command line string type. | 35 // The native command line string type. |
| 36 using StringType = string16; | 36 using StringType = string16; |
| 37 #elif defined(OS_POSIX) | 37 #elif defined(OS_POSIX) || defined(OS_FUCHSIA) |
|
jamesr
2017/02/17 00:44:10
I think OS_POSIX should be true when current_os ==
scottmg
2017/02/17 00:48:11
Thanks! I waffled on that for a while. I wasn't su
| |
| 38 using StringType = std::string; | 38 using StringType = std::string; |
| 39 #endif | 39 #endif |
| 40 | 40 |
| 41 using CharType = StringType::value_type; | 41 using CharType = StringType::value_type; |
| 42 using StringVector = std::vector<StringType>; | 42 using StringVector = std::vector<StringType>; |
| 43 using SwitchMap = std::map<std::string, StringType>; | 43 using SwitchMap = std::map<std::string, StringType>; |
| 44 using StringPieceSwitchMap = std::map<StringPiece, const StringType*>; | 44 using StringPieceSwitchMap = std::map<StringPiece, const StringType*>; |
| 45 | 45 |
| 46 // A constructor for CommandLines that only carry switches and arguments. | 46 // A constructor for CommandLines that only carry switches and arguments. |
| 47 enum NoProgram { NO_PROGRAM }; | 47 enum NoProgram { NO_PROGRAM }; |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 // Used for allocation-free lookups. | 250 // Used for allocation-free lookups. |
| 251 StringPieceSwitchMap switches_by_stringpiece_; | 251 StringPieceSwitchMap switches_by_stringpiece_; |
| 252 | 252 |
| 253 // The index after the program and switches, any arguments start here. | 253 // The index after the program and switches, any arguments start here. |
| 254 size_t begin_args_; | 254 size_t begin_args_; |
| 255 }; | 255 }; |
| 256 | 256 |
| 257 } // namespace base | 257 } // namespace base |
| 258 | 258 |
| 259 #endif // BASE_COMMAND_LINE_H_ | 259 #endif // BASE_COMMAND_LINE_H_ |
| OLD | NEW |