diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-13 02:07:25 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-13 02:07:25 +0000 |
commit | b7e0a2a3ccf5aceb891d5e1dfaf9db1bbaaa5f78 (patch) | |
tree | d723b8556ad386a0b8a6e999e3a842e0bfe6f9b0 /base/command_line.h | |
parent | 1976d41ac728fcceb30f2df3c243cb7417f538f1 (diff) | |
download | chromium_src-b7e0a2a3ccf5aceb891d5e1dfaf9db1bbaaa5f78.zip chromium_src-b7e0a2a3ccf5aceb891d5e1dfaf9db1bbaaa5f78.tar.gz chromium_src-b7e0a2a3ccf5aceb891d5e1dfaf9db1bbaaa5f78.tar.bz2 |
Use ASCII strings for switch names.
Review URL: http://codereview.chromium.org/270062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28779 0039d316-1c4b-4281-b951-d872f2087c98
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); |