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