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" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/third_party/icu/icu_utf.h" | 10 #include "base/third_party/icu/icu_utf.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 char16 c, | 131 char16 c, |
132 std::vector<string16>* r) { | 132 std::vector<string16>* r) { |
133 DCHECK(CBU16_IS_SINGLE(c)); | 133 DCHECK(CBU16_IS_SINGLE(c)); |
134 SplitStringT(str, c, true, r); | 134 SplitStringT(str, c, true, r); |
135 } | 135 } |
136 | 136 |
137 void SplitString(const std::string& str, | 137 void SplitString(const std::string& str, |
138 char c, | 138 char c, |
139 std::vector<std::string>* r) { | 139 std::vector<std::string>* r) { |
140 #if CHAR_MIN < 0 | 140 #if CHAR_MIN < 0 |
141 DCHECK(c >= 0); | 141 DCHECK_GE(c, 0); |
142 #endif | 142 #endif |
143 DCHECK(c < 0x7F); | 143 DCHECK_LT(c, 0x7F); |
144 SplitStringT(str, c, true, r); | 144 SplitStringT(str, c, true, r); |
145 } | 145 } |
146 | 146 |
147 bool SplitStringIntoKeyValuePairs(const std::string& line, | 147 bool SplitStringIntoKeyValuePairs(const std::string& line, |
148 char key_value_delimiter, | 148 char key_value_delimiter, |
149 char key_value_pair_delimiter, | 149 char key_value_pair_delimiter, |
150 StringPairs* key_value_pairs) { | 150 StringPairs* key_value_pairs) { |
151 key_value_pairs->clear(); | 151 key_value_pairs->clear(); |
152 | 152 |
153 std::vector<std::string> pairs; | 153 std::vector<std::string> pairs; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 std::vector<string16>* r) { | 188 std::vector<string16>* r) { |
189 DCHECK(CBU16_IS_SINGLE(c)); | 189 DCHECK(CBU16_IS_SINGLE(c)); |
190 SplitStringT(str, c, false, r); | 190 SplitStringT(str, c, false, r); |
191 } | 191 } |
192 | 192 |
193 void SplitStringDontTrim(const std::string& str, | 193 void SplitStringDontTrim(const std::string& str, |
194 char c, | 194 char c, |
195 std::vector<std::string>* r) { | 195 std::vector<std::string>* r) { |
196 DCHECK(IsStringUTF8(str)); | 196 DCHECK(IsStringUTF8(str)); |
197 #if CHAR_MIN < 0 | 197 #if CHAR_MIN < 0 |
198 DCHECK(c >= 0); | 198 DCHECK_GE(c, 0); |
199 #endif | 199 #endif |
200 DCHECK(c < 0x7F); | 200 DCHECK_LT(c, 0x7F); |
201 SplitStringT(str, c, false, r); | 201 SplitStringT(str, c, false, r); |
202 } | 202 } |
203 | 203 |
204 void SplitStringAlongWhitespace(const string16& str, | 204 void SplitStringAlongWhitespace(const string16& str, |
205 std::vector<string16>* result) { | 205 std::vector<string16>* result) { |
206 SplitStringAlongWhitespaceT(str, result); | 206 SplitStringAlongWhitespaceT(str, result); |
207 } | 207 } |
208 | 208 |
209 void SplitStringAlongWhitespace(const std::string& str, | 209 void SplitStringAlongWhitespace(const std::string& str, |
210 std::vector<std::string>* result) { | 210 std::vector<std::string>* result) { |
211 SplitStringAlongWhitespaceT(str, result); | 211 SplitStringAlongWhitespaceT(str, result); |
212 } | 212 } |
213 | 213 |
214 } // namespace base | 214 } // namespace base |
OLD | NEW |