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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 171 |
172 // these methods edit the string | 172 // these methods edit the string |
173 | 173 |
174 SkString& operator=(const SkString&); | 174 SkString& operator=(const SkString&); |
175 SkString& operator=(const char text[]); | 175 SkString& operator=(const char text[]); |
176 | 176 |
177 char* writable_str(); | 177 char* writable_str(); |
178 char& operator[](size_t n) { return this->writable_str()[n]; } | 178 char& operator[](size_t n) { return this->writable_str()[n]; } |
179 | 179 |
180 void reset(); | 180 void reset(); |
| 181 /** Destructive resize, does not preserve contents. */ |
181 void resize(size_t len) { this->set(NULL, len); } | 182 void resize(size_t len) { this->set(NULL, len); } |
182 void set(const SkString& src) { *this = src; } | 183 void set(const SkString& src) { *this = src; } |
183 void set(const char text[]); | 184 void set(const char text[]); |
184 void set(const char text[], size_t len); | 185 void set(const char text[], size_t len); |
185 void setUTF16(const uint16_t[]); | 186 void setUTF16(const uint16_t[]); |
186 void setUTF16(const uint16_t[], size_t len); | 187 void setUTF16(const uint16_t[], size_t len); |
187 | 188 |
188 void insert(size_t offset, const SkString& src) { this->insert(offset, src.c
_str(), src.size()); } | 189 void insert(size_t offset, const SkString& src) { this->insert(offset, src.c
_str(), src.size()); } |
189 void insert(size_t offset, const char text[]); | 190 void insert(size_t offset, const char text[]); |
190 void insert(size_t offset, const char text[], size_t len); | 191 void insert(size_t offset, const char text[], size_t len); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // 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 |
264 // declared in SkTypes.h and called by SkTSort. | 265 // declared in SkTypes.h and called by SkTSort. |
265 template <> inline void SkTSwap(SkString& a, SkString& b) { | 266 template <> inline void SkTSwap(SkString& a, SkString& b) { |
266 a.swap(b); | 267 a.swap(b); |
267 } | 268 } |
268 | 269 |
269 // Split str on any characters in delimiters into out. (Think, strtok with a sa
ne API.) | 270 // Split str on any characters in delimiters into out. (Think, strtok with a sa
ne API.) |
270 void SkStrSplit(const char* str, const char* delimiters, SkTArray<SkString>* out
); | 271 void SkStrSplit(const char* str, const char* delimiters, SkTArray<SkString>* out
); |
271 | 272 |
272 #endif | 273 #endif |
OLD | NEW |