8 #ifndef SkDataTable_DEFINED
9 #define SkDataTable_DEFINED
11 #include "../private/SkTDArray.h"
12 #include "SkChunkAlloc.h"
26 bool isEmpty()
const {
return 0 == fCount; }
31 int count()
const {
return fCount; }
37 size_t atSize(
int index)
const;
46 const void* at(
int index,
size_t* size = NULL)
const;
49 const T* atT(
int index,
size_t* size = NULL)
const {
50 return reinterpret_cast<const T*
>(this->at(index, size));
57 const char*
atStr(
int index)
const {
59 const char* str = this->atT<const char>(index, &size);
60 SkASSERT(strlen(str) + 1 == size);
64 typedef void (*FreeProc)(
void* context);
78 const size_t sizes[],
int count);
88 static sk_sp<SkDataTable> MakeCopyArray(
const void* array,
size_t elemSize,
int count);
91 FreeProc proc,
void* context);
107 void* fFreeProcContext;
110 SkDataTable(
const void* array,
size_t elemSize,
int count,
111 FreeProc,
void* context);
112 SkDataTable(
const Dir*,
int count, FreeProc,
void* context);
129 int count()
const {
return fDir.count(); }
130 size_t minChunkSize()
const {
return fMinChunkSize; }
135 void reset(
size_t minChunkSize);
137 this->reset(fMinChunkSize);
143 void append(
const void* data,
size_t size);
150 this->append(str, strlen(str) + 1);
158 this->append(
string.c_str(),
string.size() + 1);
169 SkTDArray<SkDataTable::Dir> fDir;
171 size_t fMinChunkSize;
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:57
Like SkData, SkDataTable holds an immutable data buffer.
Definition: SkDataTable.h:21
Helper class that allows for incrementally building up the data needed to create a SkDataTable...
Definition: SkDataTable.h:124
Definition: SkRefCnt.h:135
Definition: SkChunkAlloc.h:15
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:258
void appendStr(const char str[])
Helper version of append() passes strlen() + 1 for the size, so the trailing-zero will be copied as w...
Definition: SkDataTable.h:149
int count() const
Return the number of entries in the table.
Definition: SkDataTable.h:31
void appendString(const SkString &string)
Helper version of append() passes string.size() + 1 for the size, so the trailing-zero will be copied...
Definition: SkDataTable.h:157
bool isEmpty() const
Returns true if the table is empty (i.e.
Definition: SkDataTable.h:26
Definition: SkDataTable.h:94
Light weight class for managing strings.
Definition: SkString.h:121