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

Unified Diff: base/command_line.h

Issue 3012021: CommandLine: add a CopySwitchesFrom() for copying from another CommandLine (Closed)
Patch Set: minor cleanups Created 10 years, 5 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 | « no previous file | 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 7ef83bc171f686dc4a83930681c1a17433349266..89df3924fd0ff41a90c90694d97aa8ed693c5c42 100644
--- a/base/command_line.h
+++ b/base/command_line.h
@@ -101,10 +101,9 @@ class CommandLine {
// Returns the value associated with the given switch. If the
// switch has no value or isn't present, this method returns
// the empty string.
- // TODO(evanm): move these into command_line.cpp once we've fixed the
- // wstringness.
std::string GetSwitchValueASCII(const std::string& switch_string) const;
FilePath GetSwitchValuePath(const std::string& switch_string) const;
+ StringType GetSwitchValueNative(const std::string& switch_string) const;
// Deprecated versions of the above.
std::wstring GetSwitchValue(const std::string& switch_string) const;
@@ -156,12 +155,17 @@ class CommandLine {
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.
+ // Append a switch to the command line.
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.
+ // Append a switch and value to the command line.
+ void AppendSwitchPath(const std::string& switch_string, const FilePath& path);
+ void AppendSwitchNative(const std::string& switch_string,
+ const StringType& value);
+
+ // Append a switch and value to the command line.
+ // TODO(evanm): remove all AppendSwitchWithValue() instances.
+ // TODO(evanm): add an *ASCII() version.
void AppendSwitchWithValue(const std::string& switch_string,
const std::wstring& value_string);
void AppendSwitchWithValue(const std::string& switch_string,
@@ -179,6 +183,11 @@ class CommandLine {
// "valgrind" or "gdb --args").
void PrependWrapper(const std::wstring& wrapper);
+ // Copy a set of switches (and their values, if any) from another command
+ // line. Commonly used when launching a subprocess.
+ void CopySwitchesFrom(const CommandLine& source, const char* const switches[],
+ size_t count);
+
private:
friend class InProcessBrowserTest;
« no previous file with comments | « no previous file | base/command_line.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698