OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 considered "loose parameters". Switch names are | 8 // switch prefix are considered "loose parameters". Switch names are |
9 // case-insensitive. An argument of "--" will terminate switch | 9 // case-insensitive. An argument of "--" will terminate switch |
10 // parsing, causing everything after to be considered as loose | 10 // parsing, causing everything after to be considered as loose |
11 // parameters. | 11 // parameters. |
12 | 12 |
13 // There is a singleton read-only CommandLine that represents the command | 13 // There is a singleton read-only CommandLine that represents the command |
14 // line that the current process was started with. It must be initialized | 14 // line that the current process was started with. It must be initialized |
15 // in main() (or whatever the platform's equivalent function is). | 15 // in main() (or whatever the platform's equivalent function is). |
16 | 16 |
17 #ifndef BASE_COMMAND_LINE_H_ | 17 #ifndef BASE_COMMAND_LINE_H_ |
18 #define BASE_COMMAND_LINE_H_ | 18 #define BASE_COMMAND_LINE_H_ |
19 | 19 |
20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
21 | 21 |
22 #include <map> | 22 #include <map> |
23 #include <string> | 23 #include <string> |
24 #include <vector> | 24 #include <vector> |
25 | 25 |
26 #include "base/basictypes.h" | 26 #include "base/basictypes.h" |
27 #include "base/logging.h" | 27 #include "base/logging.h" |
28 #include "base/scoped_ptr.h" | |
29 | 28 |
30 class InProcessBrowserTest; | 29 class InProcessBrowserTest; |
31 | 30 |
32 class CommandLine { | 31 class CommandLine { |
33 public: | 32 public: |
34 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
35 // Creates a parsed version of the given command-line string. | 34 // Creates a parsed version of the given command-line string. |
36 // The program name is assumed to be the first item in the string. | 35 // The program name is assumed to be the first item in the string. |
37 void ParseFromString(const std::wstring& command_line); | 36 void ParseFromString(const std::wstring& command_line); |
38 #elif defined(OS_POSIX) | 37 #elif defined(OS_POSIX) |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 std::vector<StringType> loose_values_; | 176 std::vector<StringType> loose_values_; |
178 | 177 |
179 // We allow copy constructors, because a common pattern is to grab a | 178 // We allow copy constructors, because a common pattern is to grab a |
180 // copy of the current process's command line and then add some | 179 // copy of the current process's command line and then add some |
181 // flags to it. E.g.: | 180 // flags to it. E.g.: |
182 // CommandLine cl(*CommandLine::ForCurrentProcess()); | 181 // CommandLine cl(*CommandLine::ForCurrentProcess()); |
183 // cl.AppendSwitch(...); | 182 // cl.AppendSwitch(...); |
184 }; | 183 }; |
185 | 184 |
186 #endif // BASE_COMMAND_LINE_H_ | 185 #endif // BASE_COMMAND_LINE_H_ |
OLD | NEW |