diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-07 18:06:45 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-07 18:06:45 +0000 |
commit | a502bbe7a3ea0d4909e4e163ab00a1f3be483143 (patch) | |
tree | c53bf6b7492be39d1fb2eaa4cacbc74f8d0c8cb1 /base/command_line.h | |
parent | 8ebb7703fb1fd95f993081e674d04167fe1413fc (diff) | |
download | chromium_src-a502bbe7a3ea0d4909e4e163ab00a1f3be483143.zip chromium_src-a502bbe7a3ea0d4909e4e163ab00a1f3be483143.tar.gz chromium_src-a502bbe7a3ea0d4909e4e163ab00a1f3be483143.tar.bz2 |
Start sorting methods in class declarations.
A lot of our headers are a mess and aren't organized. Impose the following
order on files in the base/ directory:
class Blah {
each public/protected/private section:
typedefs;
enums;
static constants;
ctors;
dtors;
methods;
overridden virtual methods;
data members;
};
BUG=68682
TEST=compiles
Review URL: http://codereview.chromium.org/6081007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70749 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/command_line.h')
-rw-r--r-- | base/command_line.h | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/base/command_line.h b/base/command_line.h index 0e6ac26..b8bbba9 100644 --- a/base/command_line.h +++ b/base/command_line.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -29,36 +29,44 @@ class InProcessBrowserTest; class CommandLine { public: +#if defined(OS_WIN) + // The type of native command line arguments. + typedef std::wstring StringType; +#elif defined(OS_POSIX) + // The type of native command line arguments. + typedef std::string StringType; +#endif + + // The type of map for parsed-out switch key and values. + typedef std::map<std::string, StringType> SwitchMap; + // A constructor for CommandLines that are used only to carry switches and // arguments. enum NoProgram { NO_PROGRAM }; explicit CommandLine(NoProgram no_program); + + // Construct a new, empty command line. + // |program| is the name of the program to run (aka argv[0]). + explicit CommandLine(const FilePath& program); + +#if defined(OS_POSIX) + CommandLine(int argc, const char* const* argv); + explicit CommandLine(const std::vector<std::string>& argv); +#endif + ~CommandLine(); #if defined(OS_WIN) - // The type of native command line arguments. - typedef std::wstring StringType; - // Initialize by parsing the given command-line string. // The program name is assumed to be the first item in the string. void ParseFromString(const std::wstring& command_line); static CommandLine FromString(const std::wstring& command_line); #elif defined(OS_POSIX) - // The type of native command line arguments. - typedef std::string StringType; - // Initialize from an argv vector. void InitFromArgv(int argc, const char* const* argv); void InitFromArgv(const std::vector<std::string>& argv); - - CommandLine(int argc, const char* const* argv); - explicit CommandLine(const std::vector<std::string>& argv); #endif - // Construct a new, empty command line. - // |program| is the name of the program to run (aka argv[0]). - explicit CommandLine(const FilePath& program); - // Initialize the current process CommandLine singleton. On Windows, // ignores its arguments (we instead parse GetCommandLineW() // directly) because we don't trust the CRT's parsing of the command @@ -91,9 +99,6 @@ class CommandLine { // Get the number of switches in this process. size_t GetSwitchCount() const { return switches_.size(); } - // The type of map for parsed-out switch key and values. - typedef std::map<std::string, StringType> SwitchMap; - // Get a copy of all switches, along with their values const SwitchMap& GetSwitches() const { return switches_; @@ -161,6 +166,12 @@ class CommandLine { // Used by InProcessBrowserTest. static CommandLine* ForCurrentProcessMutable(); + // Returns true and fills in |switch_string| and |switch_value| + // if |parameter_string| represents a switch. + static bool IsSwitch(const StringType& parameter_string, + std::string* switch_string, + StringType* switch_value); + // The singleton CommandLine instance representing the current process's // command line. static CommandLine* current_process_commandline_; @@ -178,12 +189,6 @@ class CommandLine { std::vector<std::string> argv_; #endif - // Returns true and fills in |switch_string| and |switch_value| - // if |parameter_string| represents a switch. - static bool IsSwitch(const StringType& parameter_string, - std::string* switch_string, - StringType* switch_value); - // Parsed-out values. SwitchMap switches_; |