diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-28 17:25:28 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-28 17:25:28 +0000 |
commit | 5d91c9e739630685fbff5341abdbd1259f0e63ff (patch) | |
tree | 04e82f352e32cfa77985b707c55f661a8f733268 /base/command_line.cc | |
parent | 37e658bd7bcf3e6a6d474f1826b5b03c4485afcb (diff) | |
download | chromium_src-5d91c9e739630685fbff5341abdbd1259f0e63ff.zip chromium_src-5d91c9e739630685fbff5341abdbd1259f0e63ff.tar.gz chromium_src-5d91c9e739630685fbff5341abdbd1259f0e63ff.tar.bz2 |
base/ header cleanup. Forward declaration instead of including.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3068004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53969 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/command_line.cc')
-rw-r--r-- | base/command_line.cc | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/base/command_line.cc b/base/command_line.cc index c046125..b11902b 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -104,6 +104,13 @@ void CommandLine::ParseFromString(const std::wstring& command_line) { LocalFree(args); } +// static +CommandLine CommandLine::FromString(const std::wstring& command_line) { + CommandLine cmd; + cmd.ParseFromString(command_line); + return cmd; +} + CommandLine::CommandLine(const FilePath& program) { if (!program.empty()) { program_ = program.value(); @@ -117,6 +124,14 @@ CommandLine::CommandLine(ArgumentsOnly args_only) { argv_.push_back(""); } +CommandLine::CommandLine(int argc, const char* const* argv) { + InitFromArgv(argc, argv); +} + +CommandLine::CommandLine(const std::vector<std::string>& argv) { + InitFromArgv(argv); +} + void CommandLine::InitFromArgv(int argc, const char* const* argv) { for (int i = 0; i < argc; ++i) argv_.push_back(argv[i]); @@ -265,6 +280,20 @@ bool CommandLine::HasSwitch(const std::string& switch_string) const { return switches_.find(lowercased_switch) != switches_.end(); } +bool CommandLine::HasSwitch(const std::wstring& switch_string) const { + return HasSwitch(WideToASCII(switch_string)); +} + +std::string CommandLine::GetSwitchValueASCII( + const std::string& switch_string) const { + return WideToASCII(GetSwitchValue(switch_string)); +} + +FilePath CommandLine::GetSwitchValuePath( + const std::string& switch_string) const { + return FilePath::FromWStringHack(GetSwitchValue(switch_string)); +} + std::wstring CommandLine::GetSwitchValue( const std::string& switch_string) const { std::string lowercased_switch(switch_string); @@ -286,6 +315,15 @@ std::wstring CommandLine::GetSwitchValue( } } +std::wstring CommandLine::GetSwitchValue( + const std::wstring& switch_string) const { + return GetSwitchValue(WideToASCII(switch_string)); +} + +FilePath CommandLine::GetProgram() const { + return FilePath::FromWStringHack(program()); +} + #if defined(OS_WIN) std::wstring CommandLine::program() const { return program_; @@ -432,6 +470,11 @@ void CommandLine::PrependWrapper(const std::wstring& wrapper_wide) { #endif +void CommandLine::AppendSwitchWithValue(const std::string& switch_string, + const std::string& value_string) { + AppendSwitchWithValue(switch_string, ASCIIToWide(value_string)); +} + // private CommandLine::CommandLine() { } |