diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-05 23:50:38 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-05 23:50:38 +0000 |
commit | dabd6f450e9594a8962ef6f79447a8bfdc1c9f05 (patch) | |
tree | aa4c8d04049f0ce9022fc5d4f8229f8a4584428c /base | |
parent | a414e5ee96a40adb231c5b9585db275c10c2c104 (diff) | |
download | chromium_src-dabd6f450e9594a8962ef6f79447a8bfdc1c9f05.zip chromium_src-dabd6f450e9594a8962ef6f79447a8bfdc1c9f05.tar.gz chromium_src-dabd6f450e9594a8962ef6f79447a8bfdc1c9f05.tar.bz2 |
wstring: remove wstring version of SplitString
Retry of r84336.
BUG=23581
Review URL: http://codereview.chromium.org/6930047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84355 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/string_split.cc | 10 | ||||
-rw-r--r-- | base/string_split.h | 6 | ||||
-rw-r--r-- | base/string_split_unittest.cc | 21 |
3 files changed, 21 insertions, 16 deletions
diff --git a/base/string_split.cc b/base/string_split.cc index 44b5d06..2b1a037 100644 --- a/base/string_split.cc +++ b/base/string_split.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -35,20 +35,12 @@ static void SplitStringT(const STR& str, } } -void SplitString(const std::wstring& str, - wchar_t c, - std::vector<std::wstring>* r) { - SplitStringT(str, c, true, r); -} - -#if !defined(WCHAR_T_IS_UTF16) void SplitString(const string16& str, char16 c, std::vector<string16>* r) { DCHECK(CBU16_IS_SINGLE(c)); SplitStringT(str, c, true, r); } -#endif void SplitString(const std::string& str, char c, diff --git a/base/string_split.h b/base/string_split.h index f2e8c86..883b126 100644 --- a/base/string_split.h +++ b/base/string_split.h @@ -20,12 +20,6 @@ namespace base { // |str| begins with or ends with |s|, then an empty string is inserted. // // Every substring is trimmed of any leading or trailing 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). -BASE_API void SplitString(const std::wstring& str, - wchar_t c, - std::vector<std::wstring>* r); // NOTE: |c| must be in BMP (Basic Multilingual Plane) BASE_API void SplitString(const string16& str, char16 c, diff --git a/base/string_split_unittest.cc b/base/string_split_unittest.cc index 749d566..ee5877b 100644 --- a/base/string_split_unittest.cc +++ b/base/string_split_unittest.cc @@ -1,8 +1,10 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/string_split.h" + +#include "base/utf_string_conversions.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -10,6 +12,23 @@ using ::testing::ElementsAre; namespace base { +namespace { + +#if !defined(WCHAR_T_IS_UTF16) +// Overload SplitString with a wide-char version to make it easier to +// test the string16 version with wide character literals. +void SplitString(const std::wstring& str, + wchar_t c, + std::vector<std::wstring>* result) { + std::vector<string16> result16; + SplitString(WideToUTF16(str), c, &result16); + for (size_t i = 0; i < result16.size(); ++i) + result->push_back(UTF16ToWide(result16[i])); +} +#endif + +} // anonymous namespace + class SplitStringIntoKeyValuesTest : public testing::Test { protected: std::string key; |