8#ifndef SkString_DEFINED
9#define SkString_DEFINED
29 return !strncmp(
string, prefixStr, strlen(prefixStr));
33 return (prefixChar == *
string);
36bool SkStrEndsWith(
const char string[],
const char suffixStr[]);
37bool SkStrEndsWith(
const char string[],
const char suffixChar);
41static inline int SkStrFind(
const char string[],
const char substring[]) {
42 const char *first = strstr(
string, substring);
43 if (
nullptr == first)
return -1;
44 return SkToInt(first - &
string[0]);
48 const char* last = strrchr(
string, subchar);
49 if (
nullptr == last)
return -1;
50 return SkToInt(last - &
string[0]);
53static inline bool SkStrContains(
const char string[],
const char substring[]) {
56 return (-1 !=
SkStrFind(
string, substring));
58static inline bool SkStrContains(
const char string[],
const char subchar) {
126 explicit SkString(
const std::string&);
127 explicit SkString(std::string_view);
130 bool isEmpty()
const {
return 0 == fRec->fLength; }
131 size_t size()
const {
return (
size_t) fRec->fLength; }
132 const char*
data()
const {
return fRec->data(); }
133 const char*
c_str()
const {
return fRec->data(); }
158 int find(
const char substring[])
const {
159 return SkStrFind(fRec->data(), substring);
185 void resize(
size_t len);
189 void set(std::string_view str) { this->
set(str.data(), str.size()); }
191 void insert(
size_t offset,
const char text[]);
197 void insertS64(
size_t offset, int64_t
value,
int minDigits = 0);
199 void insertU64(
size_t offset, uint64_t
value,
int minDigits = 0);
200 void insertHex(
size_t offset, uint32_t
value,
int minDigits = 0);
206 void append(std::string_view str) { this->insert((
size_t)-1, str.data(), str.size()); }
218 void prepend(std::string_view str) { this->insert(0, str.data(), str.size()); }
249 constexpr Rec(uint32_t
len, int32_t refCnt) : fLength(
len), fRefCnt(refCnt) {}
251 char*
data() {
return fBeginningOfData; }
252 const char*
data()
const {
return fBeginningOfData; }
257 int32_t getRefCnt()
const;
262 mutable std::atomic<int32_t> fRefCnt;
263 char fBeginningOfData[1] = {
'\0'};
266 void operator delete(
void*
p) { ::operator
delete(
p); }
276 SkString& validate() {
return *
this; }
277 const SkString& validate()
const {
return *
this; }
280 static const Rec gEmptyRec;
#define SK_PRINTF_LIKE(A, B)
bool equals(SkDrawable *a, SkDrawable *b)
static constexpr int kSkStrAppendS32_MaxSize
char * SkStrAppendU64(char buffer[], uint64_t, int minDigits)
static constexpr int kSkStrAppendS64_MaxSize
static constexpr int kSkStrAppendU32_MaxSize
char * SkStrAppendScalar(char buffer[], SkScalar)
char * SkStrAppendS64(char buffer[], int64_t, int minDigits)
static void swap(SkString &a, SkString &b)
static int SkStrFindLastOf(const char string[], const char subchar)
static constexpr int kSkStrAppendScalar_MaxSize
bool SkStrEndsWith(const char string[], const char suffixStr[])
static bool SkStrStartsWith(const char string[], const char prefixStr[])
static int SkStrFind(const char string[], const char substring[])
static constexpr int kSkStrAppendU64_MaxSize
char * SkStrAppendU32(char buffer[], uint32_t)
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
static bool SkStrContains(const char string[], const char substring[])
int SkStrStartsWithOneOf(const char string[], const char prefixes[])
char * SkStrAppendS32(char buffer[], int32_t)
constexpr int SkToInt(S x)
void appendUnichar(SkUnichar uni)
void append(const char text[], size_t len)
bool endsWith(const char suffixChar) const
bool startsWith(const char prefixStr[]) const
friend bool operator==(const SkString &a, const SkString &b)
bool startsWith(const char prefixChar) const
void prependS64(int32_t value, int minDigits=0)
void append(const SkString &str)
void prepend(const char text[], size_t len)
void prependS32(int32_t value)
SkString & operator+=(const char text[])
void appendS64(int64_t value, int minDigits=0)
void insert(size_t offset, const SkString &str)
void prependScalar(SkScalar value)
const char * data() const
void appendU64(uint64_t value, int minDigits=0)
void set(const SkString &src)
void prependUnichar(SkUnichar uni)
int find(const char substring[]) const
void append(const char text[])
void prepend(const SkString &str)
void set(std::string_view str)
SkString & operator+=(const char c)
void appendHex(uint32_t value, int minDigits=0)
char & operator[](size_t n)
void appendS32(int32_t value)
bool contains(const char substring[]) const
void append(std::string_view str)
void appendScalar(SkScalar value)
void appendU32(uint32_t value)
bool endsWith(const char suffixStr[]) const
void prepend(std::string_view str)
bool contains(const char subchar) const
void prependHex(uint32_t value, int minDigits=0)
std::true_type sk_is_trivially_relocatable
char operator[](size_t n) const
friend bool operator!=(const SkString &a, const SkString &b)
void prepend(const char text[])
const char * c_str() const
void insert(size_t offset, std::string_view str)
int findLastOf(const char subchar) const
static void append(char **dst, size_t *count, const char *src, size_t n)
uint32_t uint32_t * format
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1
std::string void appendf(std::string *str, const char *fmt,...) SK_PRINTF_LIKE(2
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
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 set
std::shared_ptr< const fml::Mapping > data