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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 static Rec* RefRec(Rec*); | 258 static Rec* RefRec(Rec*); |
259 }; | 259 }; |
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 } |
Kimmo Kinnunen
2015/12/07 09:26:48
Added these (copied chromium base/strings/string_s
| |
269 | 269 |
270 enum SkStrSplitResult { | |
scroggo
2015/12/07 13:27:52
Naming this "Result" makes me think this will be t
Kimmo Kinnunen
2015/12/08 09:07:51
Done.
| |
271 // Strictly return all results. If the input is ",," and the separator is ', ' this will return | |
272 // an array of three empty strings. | |
273 kAll_SkStrSplitResult, | |
scroggo
2015/12/07 13:27:52
I don't find these names to be very descriptive. B
Kimmo Kinnunen
2015/12/08 09:07:51
I changed them to your suggestions.
I don't neces
| |
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 kNonEmpty_SkStrSplitResult | |
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, SkStrSplitResult result Behavior, |
283 SkTArray<SkString>* out); | |
284 inline void SkStrSplit(const char* str, const char* delimiters, SkTArray<SkStrin g>* out) { | |
285 SkStrSplit(str, delimiters, kNonEmpty_SkStrSplitResult, out); | |
286 } | |
272 | 287 |
273 #endif | 288 #endif |
OLD | NEW |