OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkString_DEFINED | 10 #ifndef SkString_DEFINED |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 260 |
261 /// Creates a new string and writes into it using a printf()-style format. | 261 /// Creates a new string and writes into it using a printf()-style format. |
262 SkString SkStringPrintf(const char* format, ...); | 262 SkString SkStringPrintf(const char* format, ...); |
263 | 263 |
264 // Specialized to take advantage of SkString's fast swap path. The unspecialized
function is | 264 // Specialized to take advantage of SkString's fast swap path. The unspecialized
function is |
265 // declared in SkTypes.h and called by SkTSort. | 265 // declared in SkTypes.h and called by SkTSort. |
266 template <> inline void SkTSwap(SkString& a, SkString& b) { | 266 template <> inline void SkTSwap(SkString& a, SkString& b) { |
267 a.swap(b); | 267 a.swap(b); |
268 } | 268 } |
269 | 269 |
| 270 enum SkStrSplitMode { |
| 271 // Strictly return all results. If the input is ",," and the separator is ',
' this will return |
| 272 // an array of three empty strings. |
| 273 kStrict_SkStrSplitMode, |
| 274 |
| 275 // Only nonempty results will be added to the results. Multiple separators w
ill be |
| 276 // coalesced. Separators at the beginning and end of the input will be ignor
ed. If the input is |
| 277 // ",," and the separator is ',', this will return an empty vector. |
| 278 kCoalesce_SkStrSplitMode |
| 279 }; |
| 280 |
270 // Split str on any characters in delimiters into out. (Think, strtok with a sa
ne API.) | 281 // Split str on any characters in delimiters into out. (Think, strtok with a sa
ne API.) |
271 void SkStrSplit(const char* str, const char* delimiters, SkTArray<SkString>* out
); | 282 void SkStrSplit(const char* str, const char* delimiters, SkStrSplitMode splitMod
e, |
| 283 SkTArray<SkString>* out); |
| 284 inline void SkStrSplit(const char* str, const char* delimiters, SkTArray<SkStrin
g>* out) { |
| 285 SkStrSplit(str, delimiters, kCoalesce_SkStrSplitMode, out); |
| 286 } |
272 | 287 |
273 #endif | 288 #endif |
OLD | NEW |