/** * Like SkData, SkDataTable holds an immutable data buffer. The data buffer is * organized into a table of entries, each with a length, so the entries are * not required to all be the same size.
*/ class SK_API SkDataTable : public SkRefCnt { public: /** * Returns true if the table is empty (i.e. has no entries).
*/ bool isEmpty() const { return 0 == fCount; }
/** * Return the number of entries in the table. 0 for an empty table
*/ int count() const { return fCount; }
/** * Return the size of the index'th entry in the table. The caller must * ensure that index is valid for this table.
*/
size_t atSize(int index) const;
/** * Return a pointer to the data of the index'th entry in the table. * The caller must ensure that index is valid for this table. * * @param size If non-null, this returns the byte size of this entry. This * will be the same value that atSize(index) would return.
*/ constvoid* at(int index, size_t* size = nullptr) const;
/** * Returns the index'th entry as a c-string, and assumes that the trailing * null byte had been copied into the table as well.
*/ constchar* atStr(int index) const {
size_t size; constchar* str = this->atT<constchar>(index, &size);
SkASSERT(strlen(str) + 1 == size); return str;
}
typedefvoid (*FreeProc)(void* context);
static sk_sp<SkDataTable> MakeEmpty();
/** * Return a new DataTable that contains a copy of the data stored in each * "array". * * @param ptrs array of points to each element to be copied into the table. * @param sizes array of byte-lengths for each entry in the corresponding * ptrs[] array. * @param count the number of array elements in ptrs[] and sizes[] to copy.
*/ static sk_sp<SkDataTable> MakeCopyArrays(constvoid * const * ptrs, const size_t sizes[], int count);
/** * Return a new table that contains a copy of the data in array. * * @param array contiguous array of data for all elements to be copied. * @param elemSize byte-length for a given element. * @param count the number of entries to be copied out of array. The number * of bytes that will be copied is count * elemSize.
*/ static sk_sp<SkDataTable> MakeCopyArray(constvoid* array, size_t elemSize, int count);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.