summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-14 18:02:53 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-14 18:02:53 +0000
commit0f337f026ad2bca4d3eda9bb1cb8e5c9dc2dd7f3 (patch)
tree01373f58896646edb5760e14fb7bc1392e11cf1f /base
parent7d33ff08cb916b595a15df22d991859f5e731ec6 (diff)
downloadchromium_src-0f337f026ad2bca4d3eda9bb1cb8e5c9dc2dd7f3.zip
chromium_src-0f337f026ad2bca4d3eda9bb1cb8e5c9dc2dd7f3.tar.gz
chromium_src-0f337f026ad2bca4d3eda9bb1cb8e5c9dc2dd7f3.tar.bz2
base: remove various unused string utility functions
TEST=trybots Review URL: http://codereview.chromium.org/3753003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62580 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/string_split.cc8
-rw-r--r--base/string_split.h6
-rw-r--r--base/string_split_unittest.cc18
-rw-r--r--base/string_util.cc14
-rw-r--r--base/string_util.h2
-rw-r--r--base/stringprintf.h2
6 files changed, 11 insertions, 39 deletions
diff --git a/base/string_split.cc b/base/string_split.cc
index 1075610..b6e251f 100644
--- a/base/string_split.cc
+++ b/base/string_split.cc
@@ -153,20 +153,12 @@ void SplitStringUsingSubstr(const std::string& str,
SplitStringUsingSubstrT(str, s, r);
}
-void SplitStringDontTrim(const std::wstring& str,
- wchar_t c,
- std::vector<std::wstring>* r) {
- SplitStringT(str, c, false, r);
-}
-
-#if !defined(WCHAR_T_IS_UTF16)
void SplitStringDontTrim(const string16& str,
char16 c,
std::vector<string16>* r) {
DCHECK(CBU16_IS_SINGLE(c));
SplitStringT(str, c, false, r);
}
-#endif
void SplitStringDontTrim(const std::string& str,
char c,
diff --git a/base/string_split.h b/base/string_split.h
index 9e1af19..6af1511 100644
--- a/base/string_split.h
+++ b/base/string_split.h
@@ -57,12 +57,6 @@ void SplitStringUsingSubstr(const std::string& str,
std::vector<std::string>* r);
// The same as SplitString, but don't trim white space.
-// Where wchar_t is char16 (i.e. Windows), |c| must be in BMP
-// (Basic Multilingual Plane). Elsewhere (Linux/Mac), wchar_t
-// should be a valid Unicode code point (32-bit).
-void SplitStringDontTrim(const std::wstring& str,
- wchar_t c,
- std::vector<std::wstring>* r);
// NOTE: |c| must be in BMP (Basic Multilingual Plane)
void SplitStringDontTrim(const string16& str,
char16 c,
diff --git a/base/string_split_unittest.cc b/base/string_split_unittest.cc
index d4042ad..afdc526 100644
--- a/base/string_split_unittest.cc
+++ b/base/string_split_unittest.cc
@@ -245,20 +245,20 @@ TEST(SplitStringUsingSubstrTest, TrailingDelimitersSkipped) {
}
TEST(StringSplitTest, StringSplitDontTrim) {
- std::vector<std::wstring> r;
+ std::vector<std::string> r;
- SplitStringDontTrim(L"\t\ta\t", L'\t', &r);
+ SplitStringDontTrim("\t\ta\t", '\t', &r);
ASSERT_EQ(4U, r.size());
- EXPECT_EQ(r[0], L"");
- EXPECT_EQ(r[1], L"");
- EXPECT_EQ(r[2], L"a");
- EXPECT_EQ(r[3], L"");
+ EXPECT_EQ(r[0], "");
+ EXPECT_EQ(r[1], "");
+ EXPECT_EQ(r[2], "a");
+ EXPECT_EQ(r[3], "");
r.clear();
- SplitStringDontTrim(L"\ta\t\nb\tcc", L'\n', &r);
+ SplitStringDontTrim("\ta\t\nb\tcc", '\n', &r);
ASSERT_EQ(2U, r.size());
- EXPECT_EQ(r[0], L"\ta\t");
- EXPECT_EQ(r[1], L"b\tcc");
+ EXPECT_EQ(r[0], "\ta\t");
+ EXPECT_EQ(r[1], "b\tcc");
r.clear();
}
diff --git a/base/string_util.cc b/base/string_util.cc
index e1b80f0..b242329 100644
--- a/base/string_util.cc
+++ b/base/string_util.cc
@@ -441,14 +441,6 @@ bool WideToLatin1(const std::wstring& wide, std::string* latin1) {
return true;
}
-bool IsString8Bit(const std::wstring& str) {
- for (size_t i = 0; i < str.length(); i++) {
- if (str[i] > 255)
- return false;
- }
- return true;
-}
-
template<class STR>
static bool DoIsStringASCII(const STR& str) {
for (size_t i = 0; i < str.length(); i++) {
@@ -826,15 +818,9 @@ std::string JoinString(const std::vector<std::string>& parts, char sep) {
return JoinStringT(parts, sep);
}
-#if !defined(WCHAR_T_IS_UTF16)
string16 JoinString(const std::vector<string16>& parts, char16 sep) {
return JoinStringT(parts, sep);
}
-#endif
-
-std::wstring JoinString(const std::vector<std::wstring>& parts, wchar_t sep) {
- return JoinStringT(parts, sep);
-}
template<typename STR>
void SplitStringAlongWhitespaceT(const STR& str, std::vector<STR>* result) {
diff --git a/base/string_util.h b/base/string_util.h
index 4fb3e42..d5f9571 100644
--- a/base/string_util.h
+++ b/base/string_util.h
@@ -259,7 +259,6 @@ bool WideToLatin1(const std::wstring& wide, std::string* latin1);
// to have the maximum 'discriminating' power from other encodings. If
// there's a use case for just checking the structural validity, we have to
// add a new function for that.
-bool IsString8Bit(const std::wstring& str);
bool IsStringUTF8(const std::string& str);
bool IsStringASCII(const std::wstring& str);
bool IsStringASCII(const base::StringPiece& str);
@@ -511,7 +510,6 @@ size_t Tokenize(const base::StringPiece& str,
std::vector<base::StringPiece>* tokens);
// Does the opposite of SplitString().
-std::wstring JoinString(const std::vector<std::wstring>& parts, wchar_t s);
string16 JoinString(const std::vector<string16>& parts, char16 s);
std::string JoinString(const std::vector<std::string>& parts, char s);
diff --git a/base/stringprintf.h b/base/stringprintf.h
index 43d60d4..a502a2f8 100644
--- a/base/stringprintf.h
+++ b/base/stringprintf.h
@@ -30,6 +30,8 @@ const std::wstring& SStringPrintf(std::wstring* dst,
// Append result to a supplied string.
void StringAppendF(std::string* dst, const char* format, ...)
PRINTF_FORMAT(2, 3);
+// TODO(evanm): this is only used in a few places in the code;
+// replace with string16 version.
void StringAppendF(std::wstring* dst, const wchar_t* format, ...)
WPRINTF_FORMAT(2, 3);