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, as in | 6 // Switches can optionally have a value attached using an equals sign, as in |
7 // "-switch=value". Arguments that aren't prefixed with a switch prefix are | 7 // "-switch=value". Arguments that aren't prefixed with a switch prefix are |
8 // saved as extra arguments. An argument of "--" will terminate switch parsing, | 8 // saved as extra arguments. An argument of "--" will terminate switch parsing, |
9 // causing everything after to be considered as extra arguments. | 9 // causing everything after to be considered as extra arguments. |
10 | 10 |
11 // There is a singleton read-only CommandLine that represents the command line | 11 // There is a singleton read-only CommandLine that represents the command line |
12 // that the current process was started with. It must be initialized in main(). | 12 // that the current process was started with. It must be initialized in main(). |
13 | 13 |
14 #ifndef BASE_COMMAND_LINE_H_ | 14 #ifndef BASE_COMMAND_LINE_H_ |
15 #define BASE_COMMAND_LINE_H_ | 15 #define BASE_COMMAND_LINE_H_ |
16 #pragma once | 16 #pragma once |
17 | 17 |
| 18 #include <stddef.h> |
18 #include <map> | 19 #include <map> |
19 #include <string> | 20 #include <string> |
20 #include <vector> | 21 #include <vector> |
21 | 22 |
22 #include "base/base_api.h" | 23 #include "base/base_api.h" |
23 #include "base/basictypes.h" | |
24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
25 | 25 |
26 class FilePath; | 26 class FilePath; |
27 | 27 |
28 class BASE_API CommandLine { | 28 class BASE_API CommandLine { |
29 public: | 29 public: |
30 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
31 // The native command line string type. | 31 // The native command line string type. |
32 typedef std::wstring StringType; | 32 typedef std::wstring StringType; |
33 #elif defined(OS_POSIX) | 33 #elif defined(OS_POSIX) |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // Non-switch command line arguments. | 174 // Non-switch command line arguments. |
175 StringVector args_; | 175 StringVector args_; |
176 | 176 |
177 // Allow the copy constructor. A common pattern is to copy the current | 177 // Allow the copy constructor. A common pattern is to copy the current |
178 // process's command line and then add some flags to it. For example: | 178 // process's command line and then add some flags to it. For example: |
179 // CommandLine cl(*CommandLine::ForCurrentProcess()); | 179 // CommandLine cl(*CommandLine::ForCurrentProcess()); |
180 // cl.AppendSwitch(...); | 180 // cl.AppendSwitch(...); |
181 }; | 181 }; |
182 | 182 |
183 #endif // BASE_COMMAND_LINE_H_ | 183 #endif // BASE_COMMAND_LINE_H_ |
OLD | NEW |