8 #ifndef SkDataTable_DEFINED
9 #define SkDataTable_DEFINED
12 #include "include/private/base/SkAPI.h"
13 #include "include/private/base/SkAssert.h"
28 bool isEmpty()
const {
return 0 == fCount; }
33 int count()
const {
return fCount; }
48 const void*
at(
int index,
size_t* size =
nullptr)
const;
51 const T*
atT(
int index,
size_t* size =
nullptr)
const {
52 return reinterpret_cast<const T*
>(this->at(index, size));
59 const char*
atStr(
int index)
const {
61 const char* str = this->atT<const char>(index, &size);
62 SkASSERT(strlen(str) + 1 == size);
66 typedef void (*FreeProc)(
void* context);
80 const size_t sizes[],
int count);
93 FreeProc proc,
void* context);
109 void* fFreeProcContext;
112 SkDataTable(
const void* array,
size_t elemSize,
int count,
113 FreeProc,
void* context);
114 SkDataTable(
const Dir*,
int count, FreeProc,
void* context);
117 friend class SkDataTableBuilder;
Like SkData, SkDataTable holds an immutable data buffer.
Definition: SkDataTable.h:23
static sk_sp< SkDataTable > MakeArrayProc(const void *array, size_t elemSize, int count, FreeProc proc, void *context)
int count() const
Return the number of entries in the table.
Definition: SkDataTable.h:33
static sk_sp< SkDataTable > MakeCopyArrays(const void *const *ptrs, const size_t sizes[], int count)
Return a new DataTable that contains a copy of the data stored in each "array".
static sk_sp< SkDataTable > MakeCopyArray(const void *array, size_t elemSize, int count)
Return a new table that contains a copy of the data in array.
const void * at(int index, size_t *size=nullptr) const
Return a pointer to the data of the index'th entry in the table.
const char * atStr(int index) const
Returns the index'th entry as a c-string, and assumes that the trailing null byte had been copied int...
Definition: SkDataTable.h:59
const char * fElems
Definition: SkDataTable.h:105
bool isEmpty() const
Returns true if the table is empty (i.e.
Definition: SkDataTable.h:28
const T * atT(int index, size_t *size=nullptr) const
Definition: SkDataTable.h:51
static sk_sp< SkDataTable > MakeEmpty()
const Dir * fDir
Definition: SkDataTable.h:104
size_t atSize(int index) const
Return the size of the index'th entry in the table.
Definition: SkRefCnt.h:119
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:220