| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 for (const StringPiece& pair : pairs) { | 220 for (const StringPiece& pair : pairs) { |
| 221 if (!AppendStringKeyValue(pair, key_value_delimiter, key_value_pairs)) { | 221 if (!AppendStringKeyValue(pair, key_value_delimiter, key_value_pairs)) { |
| 222 // Don't return here, to allow for pairs without associated | 222 // Don't return here, to allow for pairs without associated |
| 223 // value or key; just record that the split failed. | 223 // value or key; just record that the split failed. |
| 224 success = false; | 224 success = false; |
| 225 } | 225 } |
| 226 } | 226 } |
| 227 return success; | 227 return success; |
| 228 } | 228 } |
| 229 | 229 |
| 230 void SplitStringUsingSubstr(StringPiece16 input, | 230 std::vector<string16> SplitStringUsingSubstr(StringPiece16 input, |
| 231 StringPiece16 delimiter, | 231 StringPiece16 delimiter, |
| 232 std::vector<string16>* result) { | 232 WhitespaceHandling whitespace, |
| 233 SplitStringUsingSubstrT(input, delimiter, TRIM_WHITESPACE, SPLIT_WANT_ALL, | 233 SplitResult result_type) { |
| 234 result); | 234 std::vector<string16> result; |
| 235 SplitStringUsingSubstrT(input, delimiter, whitespace, result_type, &result); |
| 236 return result; |
| 235 } | 237 } |
| 236 | 238 |
| 237 void SplitStringUsingSubstr(StringPiece input, | 239 std::vector<std::string> SplitStringUsingSubstr(StringPiece input, |
| 238 StringPiece delimiter, | 240 StringPiece delimiter, |
| 239 std::vector<std::string>* result) { | 241 WhitespaceHandling whitespace, |
| 240 SplitStringUsingSubstrT(input, delimiter, TRIM_WHITESPACE, SPLIT_WANT_ALL, | 242 SplitResult result_type) { |
| 241 result); | 243 std::vector<std::string> result; |
| 244 SplitStringUsingSubstrT(input, delimiter, whitespace, result_type, &result); |
| 245 return result; |
| 242 } | 246 } |
| 243 | 247 |
| 244 std::vector<StringPiece16> SplitStringPieceUsingSubstr( | 248 std::vector<StringPiece16> SplitStringPieceUsingSubstr( |
| 245 StringPiece16 input, | 249 StringPiece16 input, |
| 246 StringPiece16 delimiter, | 250 StringPiece16 delimiter, |
| 247 WhitespaceHandling whitespace, | 251 WhitespaceHandling whitespace, |
| 248 SplitResult result_type) { | 252 SplitResult result_type) { |
| 249 std::vector<StringPiece16> result; | 253 std::vector<StringPiece16> result; |
| 250 SplitStringUsingSubstrT(input, delimiter, whitespace, result_type, &result); | 254 SplitStringUsingSubstrT(input, delimiter, whitespace, result_type, &result); |
| 251 return result; | 255 return result; |
| 252 } | 256 } |
| 253 | 257 |
| 254 std::vector<StringPiece> SplitStringPieceUsingSubstr( | 258 std::vector<StringPiece> SplitStringPieceUsingSubstr( |
| 255 StringPiece input, | 259 StringPiece input, |
| 256 StringPiece delimiter, | 260 StringPiece delimiter, |
| 257 WhitespaceHandling whitespace, | 261 WhitespaceHandling whitespace, |
| 258 SplitResult result_type) { | 262 SplitResult result_type) { |
| 259 std::vector<StringPiece> result; | 263 std::vector<StringPiece> result; |
| 260 SplitStringUsingSubstrT(input, delimiter, whitespace, result_type, &result); | 264 SplitStringUsingSubstrT(input, delimiter, whitespace, result_type, &result); |
| 261 return result; | 265 return result; |
| 262 } | 266 } |
| 263 | 267 |
| 264 } // namespace base | 268 } // namespace base |
| OLD | NEW |