Index: base/command_line.cc |
diff --git a/base/command_line.cc b/base/command_line.cc |
index c046125b5e624d4cf2c4630c8b294440c32fd653..b11902bc11f055de77429c26b4a2bc0988bcaf5c 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() { |
} |