Skia
2D Graphics Library
SkDataTable Class Reference

Like SkData, SkDataTable holds an immutable data buffer. More...

#include <SkDataTable.h>

Inheritance diagram for SkDataTable:

Public Types

typedef void(* FreeProc) (void *context)
 

Public Member Functions

bool isEmpty () const
 Returns true if the table is empty (i.e. More...
 
int count () const
 Return the number of entries in the table. More...
 
size_t atSize (int index) const
 Return the size of the index'th entry in the table. More...
 
const void * at (int index, size_t *size=nullptr) const
 Return a pointer to the data of the index'th entry in the table. More...
 
template<typename T >
const T * atT (int index, size_t *size=nullptr) const
 
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 into the table as well. More...
 
bool unique () const
 May return true if the caller is the only owner. More...
 
void ref () const
 Increment the reference count. More...
 
void unref () const
 Decrement the reference count. More...
 

Static Public Member Functions

static sk_sp< SkDataTableMakeEmpty ()
 
static sk_sp< SkDataTableMakeCopyArrays (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". More...
 
static sk_sp< SkDataTableMakeCopyArray (const void *array, size_t elemSize, int count)
 Return a new table that contains a copy of the data in array. More...
 
static sk_sp< SkDataTableMakeArrayProc (const void *array, size_t elemSize, int count, FreeProc proc, void *context)
 

Friends

class SkDataTableBuilder
 

Detailed Description

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.

Member Typedef Documentation

◆ FreeProc

typedef void(* SkDataTable::FreeProc) (void *context)

Member Function Documentation

◆ at()

const void* SkDataTable::at ( int  index,
size_t *  size = nullptr 
) 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.

Parameters
sizeIf non-null, this returns the byte size of this entry. This will be the same value that atSize(index) would return.

◆ atSize()

size_t SkDataTable::atSize ( int  index) const

Return the size of the index'th entry in the table.

The caller must ensure that index is valid for this table.

◆ atStr()

const char* SkDataTable::atStr ( int  index) const
inline

Returns the index'th entry as a c-string, and assumes that the trailing null byte had been copied into the table as well.

◆ atT()

template<typename T >
const T* SkDataTable::atT ( int  index,
size_t *  size = nullptr 
) const
inline

◆ count()

int SkDataTable::count ( ) const
inline

Return the number of entries in the table.

0 for an empty table

◆ isEmpty()

bool SkDataTable::isEmpty ( ) const
inline

Returns true if the table is empty (i.e.

has no entries).

◆ MakeArrayProc()

static sk_sp<SkDataTable> SkDataTable::MakeArrayProc ( const void *  array,
size_t  elemSize,
int  count,
FreeProc  proc,
void *  context 
)
static

◆ MakeCopyArray()

static sk_sp<SkDataTable> SkDataTable::MakeCopyArray ( const void *  array,
size_t  elemSize,
int  count 
)
static

Return a new table that contains a copy of the data in array.

Parameters
arraycontiguous array of data for all elements to be copied.
elemSizebyte-length for a given element.
countthe number of entries to be copied out of array. The number of bytes that will be copied is count * elemSize.

◆ MakeCopyArrays()

static sk_sp<SkDataTable> SkDataTable::MakeCopyArrays ( const void *const *  ptrs,
const size_t  sizes[],
int  count 
)
static

Return a new DataTable that contains a copy of the data stored in each "array".

Parameters
ptrsarray of points to each element to be copied into the table.
sizesarray of byte-lengths for each entry in the corresponding ptrs[] array.
countthe number of array elements in ptrs[] and sizes[] to copy.

◆ MakeEmpty()

static sk_sp<SkDataTable> SkDataTable::MakeEmpty ( )
static

◆ ref()

void SkRefCntBase::ref ( ) const
inlineinherited

Increment the reference count.

Must be balanced by a call to unref().

◆ unique()

bool SkRefCntBase::unique ( ) const
inlineinherited

May return true if the caller is the only owner.

Ensures that all previous owner's actions are complete.

◆ unref()

void SkRefCntBase::unref ( ) const
inlineinherited

Decrement the reference count.

If the reference count is 1 before the decrement, then delete the object. Note that if this is the case, then the object needs to have been allocated via new, and not on the stack.

Friends And Related Function Documentation

◆ SkDataTableBuilder

friend class SkDataTableBuilder
friend

Member Data Documentation

◆ fDir

const Dir* SkDataTable::fDir

◆ fElems

const char* SkDataTable::fElems

The documentation for this class was generated from the following file: