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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 198 |
199 /** | 199 /** |
200 * Swap contents between this and other. This function is guaranteed | 200 * Swap contents between this and other. This function is guaranteed |
201 * to never fail or throw. | 201 * to never fail or throw. |
202 */ | 202 */ |
203 void swap(SkString& other); | 203 void swap(SkString& other); |
204 | 204 |
205 private: | 205 private: |
206 struct Rec { | 206 struct Rec { |
207 public: | 207 public: |
208 size_t fLength; | 208 uint32_t fLength; // logically size_t, but we want it to stay 32bits |
209 int32_t fRefCnt; | 209 int32_t fRefCnt; |
210 char fBeginningOfData; | 210 char fBeginningOfData; |
211 | 211 |
212 char* data() { return &fBeginningOfData; } | 212 char* data() { return &fBeginningOfData; } |
213 const char* data() const { return &fBeginningOfData; } | 213 const char* data() const { return &fBeginningOfData; } |
214 }; | 214 }; |
215 Rec* fRec; | 215 Rec* fRec; |
216 | 216 |
217 #ifdef SK_DEBUG | 217 #ifdef SK_DEBUG |
218 const char* fStr; | 218 const char* fStr; |
(...skipping 28 matching lines...) Expand all Loading... |
247 /// Creates a new string and writes into it using a printf()-style format. | 247 /// Creates a new string and writes into it using a printf()-style format. |
248 SkString SkStringPrintf(const char* format, ...); | 248 SkString SkStringPrintf(const char* format, ...); |
249 | 249 |
250 // Specialized to take advantage of SkString's fast swap path. The unspecialized
function is | 250 // Specialized to take advantage of SkString's fast swap path. The unspecialized
function is |
251 // declared in SkTypes.h and called by SkTSort. | 251 // declared in SkTypes.h and called by SkTSort. |
252 template <> inline void SkTSwap(SkString& a, SkString& b) { | 252 template <> inline void SkTSwap(SkString& a, SkString& b) { |
253 a.swap(b); | 253 a.swap(b); |
254 } | 254 } |
255 | 255 |
256 #endif | 256 #endif |
OLD | NEW |