diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-14 00:35:36 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-14 00:35:36 +0000 |
commit | 76eb0247d08fa6c503517ec1a0cb8e6566cd39c7 (patch) | |
tree | e14c2632fab2f76df22827fe0c7908fd54240699 /base | |
parent | 7f8aff5b10859950cf9a6996a5d3d288ea3c75f4 (diff) | |
download | chromium_src-76eb0247d08fa6c503517ec1a0cb8e6566cd39c7.zip chromium_src-76eb0247d08fa6c503517ec1a0cb8e6566cd39c7.tar.gz chromium_src-76eb0247d08fa6c503517ec1a0cb8e6566cd39c7.tar.bz2 |
base: Move SplitString functions into the base namespace and update the callers.
BUG=None
TEST=trybots
Review URL: http://codereview.chromium.org/3750001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62483 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/command_line.cc | 4 | ||||
-rw-r--r-- | base/process_util_linux.cc | 6 | ||||
-rw-r--r-- | base/string_split.cc | 4 | ||||
-rw-r--r-- | base/string_split.h | 6 | ||||
-rw-r--r-- | base/string_util.h | 1 | ||||
-rw-r--r-- | base/version.cc | 2 |
6 files changed, 10 insertions, 13 deletions
diff --git a/base/command_line.cc b/base/command_line.cc index 477b4e7..1c39066 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -449,7 +449,7 @@ void CommandLine::PrependWrapper(const std::wstring& wrapper) { // The wrapper may have embedded arguments (like "gdb --args"). In this case, // we don't pretend to do anything fancy, we just split on spaces. std::vector<std::wstring> wrapper_and_args; - SplitString(wrapper, ' ', &wrapper_and_args); + base::SplitString(wrapper, ' ', &wrapper_and_args); program_ = wrapper_and_args[0]; command_line_string_ = wrapper + L" " + command_line_string_; } @@ -500,7 +500,7 @@ void CommandLine::PrependWrapper(const std::string& wrapper) { // The wrapper may have embedded arguments (like "gdb --args"). In this case, // we don't pretend to do anything fancy, we just split on spaces. std::vector<std::string> wrapper_and_args; - SplitString(wrapper, ' ', &wrapper_and_args); + base::SplitString(wrapper, ' ', &wrapper_and_args); argv_.insert(argv_.begin(), wrapper_and_args.begin(), wrapper_and_args.end()); } diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc index 4c034c4..231db59 100644 --- a/base/process_util_linux.cc +++ b/base/process_util_linux.cc @@ -39,7 +39,7 @@ bool GetProcStats(pid_t pid, std::vector<std::string>* proc_stats) { std::string mem_stats; if (!file_util::ReadFileToString(stat_file, &mem_stats)) return false; - SplitString(mem_stats, ' ', proc_stats); + base::SplitString(mem_stats, ' ', proc_stats); return true; } @@ -358,7 +358,7 @@ bool ProcessMetrics::GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const { return false; std::vector<std::string> statm_vec; - SplitString(statm, ' ', &statm_vec); + base::SplitString(statm, ' ', &statm_vec); if (statm_vec.size() != 7) return false; // Not the format we expect. @@ -434,7 +434,7 @@ int ParseProcStatCPU(const std::string& input) { // 0-indexed 11th and 12th are utime and stime. On two different machines // I found 42 and 39 fields, so let's just expect the ones we need. std::vector<std::string> fields; - SplitString(input.substr(rparen + 2), ' ', &fields); + base::SplitString(input.substr(rparen + 2), ' ', &fields); if (fields.size() < 13) return -1; // Output not in the format we expect. diff --git a/base/string_split.cc b/base/string_split.cc index ca97954..1075610 100644 --- a/base/string_split.cc +++ b/base/string_split.cc @@ -9,6 +9,8 @@ #include "base/third_party/icu/icu_utf.h" #include "base/utf_string_conversions.h" +namespace base { + template<typename STR> static void SplitStringT(const STR& str, const typename STR::value_type s, @@ -55,8 +57,6 @@ void SplitString(const std::string& str, SplitStringT(str, c, true, r); } -namespace base { - bool SplitStringIntoKeyValues( const std::string& line, char key_value_delimiter, diff --git a/base/string_split.h b/base/string_split.h index c7cb5e7..9e1af19 100644 --- a/base/string_split.h +++ b/base/string_split.h @@ -12,9 +12,7 @@ #include "base/string16.h" -// TODO(tfarina): Move the following functions into the namespace and update the -// callers. -//----------------------------------------------------------------------------- +namespace base { // Splits |str| into a vector of strings delimited by |s|. Append the results // into |r| as they appear. If several instances of |s| are contiguous, or if @@ -39,8 +37,6 @@ void SplitString(const std::string& str, char c, std::vector<std::string>* r); -namespace base { - bool SplitStringIntoKeyValues( const std::string& line, char key_value_delimiter, diff --git a/base/string_util.h b/base/string_util.h index 41a0cd4..4fb3e42 100644 --- a/base/string_util.h +++ b/base/string_util.h @@ -27,6 +27,7 @@ // TODO(tfarina): Fix the rlz library to include this instead and remove // this include. #include "base/string_split.h" +using base::SplitString; #endif // RLZ_WIN_LIB_RLZ_LIB_H_ // Safe standard library wrappers for all platforms. diff --git a/base/version.cc b/base/version.cc index 22d0e04..9fbcb6a 100644 --- a/base/version.cc +++ b/base/version.cc @@ -75,7 +75,7 @@ const std::string Version::GetString() const { bool Version::InitFromString(const std::string& version_str) { DCHECK(!is_valid_); std::vector<std::string> numbers; - SplitString(version_str, '.', &numbers); + base::SplitString(version_str, '.', &numbers); if (numbers.empty()) return false; for (std::vector<std::string>::iterator i = numbers.begin(); |