diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-29 23:02:34 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-29 23:02:34 +0000 |
commit | 4f08c83f354cb0c9d2ee5c79c39c1ad08e560cdf (patch) | |
tree | 41963c12afc6c484be43d69d1c31c242ed5b7488 /base/command_line.h | |
parent | d7ab056d66464c89ba336c4b466a8ad45f2afb6e (diff) | |
download | chromium_src-4f08c83f354cb0c9d2ee5c79c39c1ad08e560cdf.zip chromium_src-4f08c83f354cb0c9d2ee5c79c39c1ad08e560cdf.tar.gz chromium_src-4f08c83f354cb0c9d2ee5c79c39c1ad08e560cdf.tar.bz2 |
CommandLine: add a CopySwitchesFrom() and AppendSwitchPath()
These are two common patterns in Chrome code: copying a
subset of switches from one CommandLine to another, and
appending a FilePath to a CommandLine. This sets me up
to do a lot more deprecation in a follow-up change.
Review URL: http://codereview.chromium.org/3012021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54218 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/command_line.h')
-rw-r--r-- | base/command_line.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/base/command_line.h b/base/command_line.h index 7ef83bc..89df392 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; |