diff options
Diffstat (limited to 'base/command_line.h')
-rw-r--r-- | base/command_line.h | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/base/command_line.h b/base/command_line.h index 4fd8e4a..78adb46 100644 --- a/base/command_line.h +++ b/base/command_line.h @@ -26,6 +26,7 @@ #include "base/basictypes.h" #include "base/file_path.h" #include "base/logging.h" +#include "base/string_util.h" class InProcessBrowserTest; @@ -88,12 +89,25 @@ class CommandLine { // Returns true if this command line contains the given switch. // (Switch names are case-insensitive.) - bool HasSwitch(const std::wstring& switch_string) const; + bool HasSwitch(const std::string& switch_string) const; + + // Deprecated version of the above. + bool HasSwitch(const std::wstring& switch_string) const { + return HasSwitch(WideToASCII(switch_string)); + } // Returns the value associated with the given switch. If the // switch has no value or isn't present, this method returns // the empty string. - std::wstring GetSwitchValue(const std::wstring& switch_string) const; + std::wstring GetSwitchValue(const std::string& switch_string) const; + std::string GetSwitchValueASCII(const std::string& switch_string) const { + return WideToASCII(GetSwitchValue(switch_string)); + } + + // Deprecated version of the above. + std::wstring GetSwitchValue(const std::wstring& switch_string) const { + return GetSwitchValue(WideToASCII(switch_string)); + } // Get the number of switches in this process. size_t GetSwitchCount() const { return switches_.size(); } @@ -125,22 +139,26 @@ class CommandLine { // Return a copy of the string prefixed with a switch prefix. // Used internally. - static std::wstring PrefixedSwitchString(const std::wstring& switch_string); + static std::wstring PrefixedSwitchString(const std::string& switch_string); // Return a copy of the string prefixed with a switch prefix, // and appended with the given value. Used internally. static std::wstring PrefixedSwitchStringWithValue( - const std::wstring& switch_string, + const std::string& switch_string, const std::wstring& value_string); // Appends the given switch string (preceded by a space and a switch // prefix) to the given string. - void AppendSwitch(const std::wstring& switch_string); + void AppendSwitch(const std::string& switch_string); // Appends the given switch string (preceded by a space and a switch // prefix) to the given string, with the given value attached. - void AppendSwitchWithValue(const std::wstring& switch_string, + void AppendSwitchWithValue(const std::string& switch_string, const std::wstring& value_string); + void AppendSwitchWithValue(const std::string& switch_string, + const std::string& value_string) { + AppendSwitchWithValue(switch_string, ASCIIToWide(value_string)); + } // Append a loose value to the command line. void AppendLooseValue(const std::wstring& value); |