| 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 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // Construct a new, empty command line. | 43 // Construct a new, empty command line. |
| 44 // |program| is the name of the program to run (aka argv[0]). | 44 // |program| is the name of the program to run (aka argv[0]). |
| 45 // TODO(port): should be a FilePath. | 45 // TODO(port): should be a FilePath. |
| 46 explicit CommandLine(const std::wstring& program); | 46 explicit CommandLine(const std::wstring& program); |
| 47 | 47 |
| 48 // Initialize the current process CommandLine singleton. On Windows, | 48 // Initialize the current process CommandLine singleton. On Windows, |
| 49 // ignores its arguments (we instead parse GetCommandLineW() | 49 // ignores its arguments (we instead parse GetCommandLineW() |
| 50 // directly) because we don't trust the CRT's parsing of the command | 50 // directly) because we don't trust the CRT's parsing of the command |
| 51 // line, but it still must be called to set up the command line. | 51 // line, but it still must be called to set up the command line. |
| 52 static void Init(int argc, const char* const* argv); | 52 static void Init(int argc, const char* const* argv); |
| 53 static void Init(const std::vector<std::string>& argv); |
| 53 | 54 |
| 54 // Destroys the current process CommandLine singleton. This is necessary if | 55 // Destroys the current process CommandLine singleton. This is necessary if |
| 55 // you want to reset the base library to its initial state (for example in an | 56 // you want to reset the base library to its initial state (for example in an |
| 56 // outer library that needs to be able to terminate, and be re-initialized). | 57 // outer library that needs to be able to terminate, and be re-initialized). |
| 57 // If Init is called only once, e.g. in main(), calling Terminate() is not | 58 // If Init is called only once, e.g. in main(), calling Terminate() is not |
| 58 // necessary. | 59 // necessary. |
| 59 static void Terminate(); | 60 static void Terminate(); |
| 60 | 61 |
| 61 // Get the singleton CommandLine representing the current process's | 62 // Get the singleton CommandLine representing the current process's |
| 62 // command line. | 63 // command line. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 std::vector<StringType> loose_values_; | 177 std::vector<StringType> loose_values_; |
| 177 | 178 |
| 178 // We allow copy constructors, because a common pattern is to grab a | 179 // We allow copy constructors, because a common pattern is to grab a |
| 179 // copy of the current process's command line and then add some | 180 // copy of the current process's command line and then add some |
| 180 // flags to it. E.g.: | 181 // flags to it. E.g.: |
| 181 // CommandLine cl(*CommandLine::ForCurrentProcess()); | 182 // CommandLine cl(*CommandLine::ForCurrentProcess()); |
| 182 // cl.AppendSwitch(...); | 183 // cl.AppendSwitch(...); |
| 183 }; | 184 }; |
| 184 | 185 |
| 185 #endif // BASE_COMMAND_LINE_H_ | 186 #endif // BASE_COMMAND_LINE_H_ |
| OLD | NEW |