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. |
11 | 11 |
12 // There is a singleton read-only CommandLine that represents the command line | 12 // There is a singleton read-only CommandLine that represents the command line |
13 // that the current process was started with. It must be initialized in main(). | 13 // that the current process was started with. It must be initialized in main(). |
14 | 14 |
15 #ifndef BASE_COMMAND_LINE_H_ | 15 #ifndef BASE_COMMAND_LINE_H_ |
16 #define BASE_COMMAND_LINE_H_ | 16 #define BASE_COMMAND_LINE_H_ |
17 #pragma once | 17 #pragma once |
18 | 18 |
19 #include <stddef.h> | 19 #include <stddef.h> |
20 #include <map> | 20 #include <map> |
21 #include <string> | 21 #include <string> |
22 #include <vector> | 22 #include <vector> |
23 | 23 |
24 #include "base/base_api.h" | 24 #include "base/base_export.h" |
25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
26 | 26 |
27 class FilePath; | 27 class FilePath; |
28 | 28 |
29 class BASE_API CommandLine { | 29 class BASE_EXPORT CommandLine { |
30 public: | 30 public: |
31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
32 // The native command line string type. | 32 // The native command line string type. |
33 typedef std::wstring StringType; | 33 typedef std::wstring StringType; |
34 #elif defined(OS_POSIX) | 34 #elif defined(OS_POSIX) |
35 typedef std::string StringType; | 35 typedef std::string StringType; |
36 #endif | 36 #endif |
37 | 37 |
38 typedef StringType::value_type CharType; | 38 typedef StringType::value_type CharType; |
39 typedef std::vector<StringType> StringVector; | 39 typedef std::vector<StringType> StringVector; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 StringVector argv_; | 156 StringVector argv_; |
157 | 157 |
158 // Parsed-out switch keys and values. | 158 // Parsed-out switch keys and values. |
159 SwitchMap switches_; | 159 SwitchMap switches_; |
160 | 160 |
161 // The index after the program and switches, any arguments start here. | 161 // The index after the program and switches, any arguments start here. |
162 size_t begin_args_; | 162 size_t begin_args_; |
163 }; | 163 }; |
164 | 164 |
165 #endif // BASE_COMMAND_LINE_H_ | 165 #endif // BASE_COMMAND_LINE_H_ |
OLD | NEW |