Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2726)

Unified Diff: base/command_line.h

Issue 270062: Use ASCII strings for switch names. (Closed)
Patch Set: victory Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/base_switches.cc ('k') | base/command_line.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/command_line.h
diff --git a/base/command_line.h b/base/command_line.h
index 8ccb93f951b8b03b224f9ed9aef225e98122613d..6f1265b498be48eee591bd9ea1ac5f82b5d3d04f 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);
« no previous file with comments | « base/base_switches.cc ('k') | base/command_line.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698