Go to the source code of this file.
|
template<int SIZE> |
static StringBuffer | apply_format_string (const char *format, va_list args, char(&stackBuffer)[SIZE], SkString *heapBuffer) SK_PRINTF_LIKE(1 |
|
template<int SIZE> |
static StringBuffer static StringBuffer | apply_format_string (const char *format, va_list args, char(&stackBuffer)[SIZE], SkString *heapBuffer) |
|
bool | SkStrEndsWith (const char string[], const char suffixStr[]) |
|
bool | SkStrEndsWith (const char string[], const char suffixChar) |
|
int | SkStrStartsWithOneOf (const char string[], const char prefixes[]) |
|
char * | SkStrAppendU32 (char string[], uint32_t dec) |
|
char * | SkStrAppendS32 (char string[], int32_t dec) |
|
char * | SkStrAppendU64 (char string[], uint64_t dec, int minDigits) |
|
char * | SkStrAppendS64 (char string[], int64_t dec, int minDigits) |
|
char * | SkStrAppendScalar (char string[], SkScalar value) |
|
static uint32_t | trim_size_t_to_u32 (size_t value) |
|
static size_t | check_add32 (size_t base, size_t extra) |
|
SkString | SkStringPrintf (const char *format,...) |
|
◆ SizeOfRec
◆ apply_format_string() [1/2]
Definition at line 39 of file SkString.cpp.
40 {
41
42 va_list argsCopy;
43 va_copy(argsCopy,
args);
45 if (outLength < 0) {
46 SkDebugf(
"SkString: vsnprintf reported error.");
48 return {stackBuffer, 0};
49 }
50 if (outLength <
SIZE) {
52 return {stackBuffer, outLength};
53 }
54
55
56
57
58 heapBuffer->
set(
nullptr, outLength);
59 char* heapBufferDest = heapBuffer->
data();
63 return {heapBufferDest, outLength};
64}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
const char * data() const
void set(const SkString &src)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint32_t uint32_t * format
◆ apply_format_string() [2/2]
static StringBuffer apply_format_string |
( |
const char * |
format, |
|
|
va_list |
args, |
|
|
char(&) |
stackBuffer[SIZE], |
|
|
SkString * |
heapBuffer |
|
) |
| |
|
static |
◆ check_add32()
static size_t check_add32 |
( |
size_t |
base, |
|
|
size_t |
extra |
|
) |
| |
|
static |
Definition at line 206 of file SkString.cpp.
206 {
208 if (sizeof(size_t) > sizeof(uint32_t)) {
209 if (
base + extra > UINT32_MAX) {
210 extra = UINT32_MAX -
base;
211 }
212 }
213 return extra;
214}
◆ SkStrAppendS32()
char * SkStrAppendS32 |
( |
char |
string[], |
|
|
int32_t |
dec |
|
) |
| |
Definition at line 120 of file SkString.cpp.
120 {
121 uint32_t udec = dec;
122 if (dec < 0) {
123 *string++ = '-';
124 udec = ~udec + 1;
125 }
127}
char * SkStrAppendU32(char string[], uint32_t dec)
◆ SkStrAppendS64()
char * SkStrAppendS64 |
( |
char |
string[], |
|
|
int64_t |
dec, |
|
|
int |
minDigits |
|
) |
| |
Definition at line 155 of file SkString.cpp.
155 {
156 uint64_t udec = dec;
157 if (dec < 0) {
158 *string++ = '-';
159 udec = ~udec + 1;
160 }
162}
char * SkStrAppendU64(char string[], uint64_t dec, int minDigits)
◆ SkStrAppendScalar()
char * SkStrAppendScalar |
( |
char |
buffer[], |
|
|
SkScalar |
value |
|
) |
| |
Write the scalar in decimal format into buffer, and return a pointer to the next char after the last one written. Note: a terminating 0 is not written into buffer, which must be at least kSkStrAppendScalar_MaxSize. Thus if the caller wants to add a 0 at the end, buffer must be at least kSkStrAppendScalar_MaxSize + 1 bytes large.
Definition at line 164 of file SkString.cpp.
164 {
165
166
168 strcpy(string, "nan");
169 return string + 3;
170 }
173 strcpy(string, "inf");
174 return string + 3;
175 } else {
176 strcpy(string, "-inf");
177 return string + 4;
178 }
179 }
180
181
182 static const char gFormat[] = "%.8g";
183
189}
static constexpr bool SkIsNaN(T x)
static bool SkIsFinite(T x, Pack... values)
static constexpr int kSkStrAppendScalar_MaxSize
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
◆ SkStrAppendU32()
char * SkStrAppendU32 |
( |
char |
string[], |
|
|
uint32_t |
dec |
|
) |
| |
Definition at line 100 of file SkString.cpp.
100 {
102
105
106 do {
108 dec /= 10;
109 } while (dec != 0);
110
113 memcpy(
string,
p, cp_len);
114 string += cp_len;
115
117 return string;
118}
static constexpr int kSkStrAppendU32_MaxSize
constexpr uint8_t SkToU8(S x)
◆ SkStrAppendU64()
char * SkStrAppendU64 |
( |
char |
string[], |
|
|
uint64_t |
dec, |
|
|
int |
minDigits |
|
) |
| |
Definition at line 129 of file SkString.cpp.
129 {
131
134
135 do {
136 *--
p =
SkToU8(
'0' + (int32_t) (dec % 10));
137 dec /= 10;
138 minDigits--;
139 } while (dec != 0);
140
141 while (minDigits > 0) {
143 minDigits--;
144 }
145
148 memcpy(
string,
p, cp_len);
149 string += cp_len;
150
152 return string;
153}
static constexpr int kSkStrAppendU64_MaxSize
◆ SkStrEndsWith() [1/2]
bool SkStrEndsWith |
( |
const char |
string[], |
|
|
const char |
suffixChar |
|
) |
| |
Definition at line 77 of file SkString.cpp.
77 {
79 size_t strLen = strlen(string);
80 if (0 == strLen) {
81 return false;
82 } else {
83 return (suffixChar == string[strLen-1]);
84 }
85}
◆ SkStrEndsWith() [2/2]
bool SkStrEndsWith |
( |
const char |
string[], |
|
|
const char |
suffixStr[] |
|
) |
| |
Definition at line 68 of file SkString.cpp.
68 {
71 size_t strLen = strlen(string);
72 size_t suffixLen = strlen(suffixStr);
73 return strLen >= suffixLen &&
74 !strncmp(string + strLen - suffixLen, suffixStr, suffixLen);
75}
◆ SkStringPrintf()
SkString SkStringPrintf |
( |
const char * |
format, |
|
|
|
... |
|
) |
| |
Definition at line 629 of file SkString.cpp.
629 {
635 return formattedOutput;
636}
void void printVAList(const char format[], va_list) SK_PRINTF_LIKE(2
◆ SkStrStartsWithOneOf()
int SkStrStartsWithOneOf |
( |
const char |
string[], |
|
|
const char |
prefixes[] |
|
) |
| |
Definition at line 87 of file SkString.cpp.
87 {
88 int index = 0;
89 do {
90 const char* limit = strchr(prefixes, '\0');
91 if (!strncmp(string, prefixes, limit - prefixes)) {
92 return index;
93 }
94 prefixes = limit + 1;
95 index++;
96 } while (prefixes[0]);
97 return -1;
98}
◆ trim_size_t_to_u32()
static uint32_t trim_size_t_to_u32 |
( |
size_t |
value | ) |
|
|
static |
Definition at line 197 of file SkString.cpp.
197 {
198 if (sizeof(size_t) > sizeof(uint32_t)) {
199 if (
value > UINT32_MAX) {
201 }
202 }
203 return (uint32_t)
value;
204}
◆ kBufferSize
const size_t kBufferSize = 1024 |
|
static |