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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 void insert(size_t offset, const SkString& src) { this->insert(offset, src.c
_str(), src.size()); } | 161 void insert(size_t offset, const SkString& src) { this->insert(offset, src.c
_str(), src.size()); } |
162 void insert(size_t offset, const char text[]); | 162 void insert(size_t offset, const char text[]); |
163 void insert(size_t offset, const char text[], size_t len); | 163 void insert(size_t offset, const char text[], size_t len); |
164 void insertUnichar(size_t offset, SkUnichar); | 164 void insertUnichar(size_t offset, SkUnichar); |
165 void insertS32(size_t offset, int32_t value); | 165 void insertS32(size_t offset, int32_t value); |
166 void insertS64(size_t offset, int64_t value, int minDigits = 0); | 166 void insertS64(size_t offset, int64_t value, int minDigits = 0); |
167 void insertHex(size_t offset, uint32_t value, int minDigits = 0); | 167 void insertHex(size_t offset, uint32_t value, int minDigits = 0); |
168 void insertScalar(size_t offset, SkScalar); | 168 void insertScalar(size_t offset, SkScalar); |
169 | 169 |
170 void append(const SkString& str) { this->insert((size_t)-1, str); } | 170 void append(const SkString& str) { this->insert((size_t)-1, str); } |
| 171 void append(const char c) { this->insert((size_t)-1, &c, 1); } |
171 void append(const char text[]) { this->insert((size_t)-1, text); } | 172 void append(const char text[]) { this->insert((size_t)-1, text); } |
172 void append(const char text[], size_t len) { this->insert((size_t)-1, text,
len); } | 173 void append(const char text[], size_t len) { this->insert((size_t)-1, text,
len); } |
173 void appendUnichar(SkUnichar uni) { this->insertUnichar((size_t)-1, uni); } | 174 void appendUnichar(SkUnichar uni) { this->insertUnichar((size_t)-1, uni); } |
174 void appendS32(int32_t value) { this->insertS32((size_t)-1, value); } | 175 void appendS32(int32_t value) { this->insertS32((size_t)-1, value); } |
175 void appendS64(int64_t value, int minDigits = 0) { this->insertS64((size_t)-
1, value, minDigits); } | 176 void appendS64(int64_t value, int minDigits = 0) { this->insertS64((size_t)-
1, value, minDigits); } |
176 void appendHex(uint32_t value, int minDigits = 0) { this->insertHex((size_t)
-1, value, minDigits); } | 177 void appendHex(uint32_t value, int minDigits = 0) { this->insertHex((size_t)
-1, value, minDigits); } |
177 void appendScalar(SkScalar value) { this->insertScalar((size_t)-1, value); } | 178 void appendScalar(SkScalar value) { this->insertScalar((size_t)-1, value); } |
178 | 179 |
179 void prepend(const SkString& str) { this->insert(0, str); } | 180 void prepend(const SkString& str) { this->insert(0, str); } |
180 void prepend(const char text[]) { this->insert(0, text); } | 181 void prepend(const char text[]) { this->insert(0, text); } |
181 void prepend(const char text[], size_t len) { this->insert(0, text, len); } | 182 void prepend(const char text[], size_t len) { this->insert(0, text, len); } |
182 void prependUnichar(SkUnichar uni) { this->insertUnichar(0, uni); } | 183 void prependUnichar(SkUnichar uni) { this->insertUnichar(0, uni); } |
183 void prependS32(int32_t value) { this->insertS32(0, value); } | 184 void prependS32(int32_t value) { this->insertS32(0, value); } |
184 void prependS64(int32_t value, int minDigits = 0) { this->insertS64(0, value
, minDigits); } | 185 void prependS64(int32_t value, int minDigits = 0) { this->insertS64(0, value
, minDigits); } |
185 void prependHex(uint32_t value, int minDigits = 0) { this->insertHex(0, valu
e, minDigits); } | 186 void prependHex(uint32_t value, int minDigits = 0) { this->insertHex(0, valu
e, minDigits); } |
186 void prependScalar(SkScalar value) { this->insertScalar((size_t)-1, value);
} | 187 void prependScalar(SkScalar value) { this->insertScalar((size_t)-1, value);
} |
187 | 188 |
188 void printf(const char format[], ...) SK_PRINTF_LIKE(2, 3); | 189 void printf(const char format[], ...) SK_PRINTF_LIKE(2, 3); |
189 void appendf(const char format[], ...) SK_PRINTF_LIKE(2, 3); | 190 void appendf(const char format[], ...) SK_PRINTF_LIKE(2, 3); |
190 void appendf(const char format[], va_list); | 191 void appendf(const char format[], va_list); |
191 void prependf(const char format[], ...) SK_PRINTF_LIKE(2, 3); | 192 void prependf(const char format[], ...) SK_PRINTF_LIKE(2, 3); |
192 | 193 |
193 void remove(size_t offset, size_t length); | 194 void remove(size_t offset, size_t length); |
194 | 195 |
195 SkString& operator+=(const SkString& s) { this->append(s); return *this; } | 196 SkString& operator+=(const SkString& s) { this->append(s); return *this; } |
196 SkString& operator+=(const char text[]) { this->append(text); return *this;
} | 197 SkString& operator+=(const char text[]) { this->append(text); return *this;
} |
197 SkString& operator+=(const char c) { this->append(&c, 1); return *this; } | 198 SkString& operator+=(const char c) { this->append(c); return *this; } |
198 | 199 |
199 /** | 200 /** |
200 * Swap contents between this and other. This function is guaranteed | 201 * Swap contents between this and other. This function is guaranteed |
201 * to never fail or throw. | 202 * to never fail or throw. |
202 */ | 203 */ |
203 void swap(SkString& other); | 204 void swap(SkString& other); |
204 | 205 |
205 private: | 206 private: |
206 struct Rec { | 207 struct Rec { |
207 public: | 208 public: |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 /// Creates a new string and writes into it using a printf()-style format. | 248 /// Creates a new string and writes into it using a printf()-style format. |
248 SkString SkStringPrintf(const char* format, ...); | 249 SkString SkStringPrintf(const char* format, ...); |
249 | 250 |
250 // Specialized to take advantage of SkString's fast swap path. The unspecialized
function is | 251 // Specialized to take advantage of SkString's fast swap path. The unspecialized
function is |
251 // declared in SkTypes.h and called by SkTSort. | 252 // declared in SkTypes.h and called by SkTSort. |
252 template <> inline void SkTSwap(SkString& a, SkString& b) { | 253 template <> inline void SkTSwap(SkString& a, SkString& b) { |
253 a.swap(b); | 254 a.swap(b); |
254 } | 255 } |
255 | 256 |
256 #endif | 257 #endif |
OLD | NEW |