OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/strings/string_split.h" | 5 #include "base/strings/string_split.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | |
10 #include "base/third_party/icu/icu_utf.h" | 9 #include "base/third_party/icu/icu_utf.h" |
11 | 10 |
12 namespace base { | 11 namespace base { |
13 | 12 |
14 namespace { | 13 namespace { |
15 | 14 |
16 template <typename STR> | 15 template <typename STR> |
17 void SplitStringT(const STR& str, | 16 void SplitStringT(const STR& str, |
18 const typename STR::value_type s, | 17 const typename STR::value_type s, |
19 bool trim_whitespace, | 18 bool trim_whitespace, |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 void SplitStringDontTrim(const string16& str, | 185 void SplitStringDontTrim(const string16& str, |
187 char16 c, | 186 char16 c, |
188 std::vector<string16>* r) { | 187 std::vector<string16>* r) { |
189 DCHECK(CBU16_IS_SINGLE(c)); | 188 DCHECK(CBU16_IS_SINGLE(c)); |
190 SplitStringT(str, c, false, r); | 189 SplitStringT(str, c, false, r); |
191 } | 190 } |
192 | 191 |
193 void SplitStringDontTrim(const std::string& str, | 192 void SplitStringDontTrim(const std::string& str, |
194 char c, | 193 char c, |
195 std::vector<std::string>* r) { | 194 std::vector<std::string>* r) { |
196 DCHECK(IsStringUTF8(str)); | |
Nico
2015/04/16 17:05:24
This change looks both unrelated and incorrect. (`
ncarter (slow)
2015/04/16 18:08:00
"only work for UTF-8" as opposed to what?
Did you
ncarter (slow)
2015/04/16 18:08:50
And oh, to understand the relationship: see the fa
| |
197 #if CHAR_MIN < 0 | 195 #if CHAR_MIN < 0 |
198 DCHECK_GE(c, 0); | 196 DCHECK_GE(c, 0); |
199 #endif | 197 #endif |
200 DCHECK_LT(c, 0x7F); | 198 DCHECK_LT(c, 0x7F); |
201 SplitStringT(str, c, false, r); | 199 SplitStringT(str, c, false, r); |
202 } | 200 } |
203 | 201 |
204 void SplitStringAlongWhitespace(const string16& str, | 202 void SplitStringAlongWhitespace(const string16& str, |
205 std::vector<string16>* result) { | 203 std::vector<string16>* result) { |
206 SplitStringAlongWhitespaceT(str, result); | 204 SplitStringAlongWhitespaceT(str, result); |
207 } | 205 } |
208 | 206 |
209 void SplitStringAlongWhitespace(const std::string& str, | 207 void SplitStringAlongWhitespace(const std::string& str, |
210 std::vector<std::string>* result) { | 208 std::vector<std::string>* result) { |
211 SplitStringAlongWhitespaceT(str, result); | 209 SplitStringAlongWhitespaceT(str, result); |
212 } | 210 } |
213 | 211 |
214 } // namespace base | 212 } // namespace base |
OLD | NEW |