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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 uint32_t fLength; // logically size_t, but we want it to stay 32bits | 231 uint32_t fLength; // logically size_t, but we want it to stay 32bits |
232 int32_t fRefCnt; | 232 int32_t fRefCnt; |
233 char fBeginningOfData; | 233 char fBeginningOfData; |
234 | 234 |
235 char* data() { return &fBeginningOfData; } | 235 char* data() { return &fBeginningOfData; } |
236 const char* data() const { return &fBeginningOfData; } | 236 const char* data() const { return &fBeginningOfData; } |
237 }; | 237 }; |
238 Rec* fRec; | 238 Rec* fRec; |
239 | 239 |
240 #ifdef SK_DEBUG | 240 #ifdef SK_DEBUG |
241 const char* fStr; | |
242 void validate() const; | 241 void validate() const; |
243 #else | 242 #else |
244 void validate() const {} | 243 void validate() const {} |
245 #endif | 244 #endif |
246 | 245 |
247 static const Rec gEmptyRec; | 246 static const Rec gEmptyRec; |
248 static Rec* AllocRec(const char text[], size_t len); | 247 static Rec* AllocRec(const char text[], size_t len); |
249 static Rec* RefRec(Rec*); | 248 static Rec* RefRec(Rec*); |
250 }; | 249 }; |
251 | 250 |
252 /// Creates a new string and writes into it using a printf()-style format. | 251 /// Creates a new string and writes into it using a printf()-style format. |
253 SkString SkStringPrintf(const char* format, ...); | 252 SkString SkStringPrintf(const char* format, ...); |
254 | 253 |
255 // Specialized to take advantage of SkString's fast swap path. The unspecialized
function is | 254 // Specialized to take advantage of SkString's fast swap path. The unspecialized
function is |
256 // declared in SkTypes.h and called by SkTSort. | 255 // declared in SkTypes.h and called by SkTSort. |
257 template <> inline void SkTSwap(SkString& a, SkString& b) { | 256 template <> inline void SkTSwap(SkString& a, SkString& b) { |
258 a.swap(b); | 257 a.swap(b); |
259 } | 258 } |
260 | 259 |
261 // Split str on any characters in delimiters into out. (Think, strtok with a sa
ne API.) | 260 // Split str on any characters in delimiters into out. (Think, strtok with a sa
ne API.) |
262 void SkStrSplit(const char* str, const char* delimiters, SkTArray<SkString>* out
); | 261 void SkStrSplit(const char* str, const char* delimiters, SkTArray<SkString>* out
); |
263 | 262 |
264 #endif | 263 #endif |
OLD | NEW |