Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkDataTable Class Reference

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

#include <SkDataTable.h>

Inheritance diagram for SkDataTable:
SkRefCnt SkRefCntBase

Classes

struct  Dir
 

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=NULL) 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=NULL) 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.
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 Default construct, initializing the reference count to 1.
 
virtual ~SkRefCntBase ()
 Destruct, asserting that the reference count is 1.
 
int32_t getRefCnt () const
 Return the reference count. More...
 
void validate () const
 
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)
 

Private Types

typedef SkRefCnt INHERITED
 

Private Member Functions

 SkDataTable (const void *array, size_t elemSize, int count, FreeProc, void *context)
 
 SkDataTable (const Dir *, int count, FreeProc, void *context)
 

Private Attributes

int fCount
 
size_t fElemSize
 
union {
   const Dir *   fDir
 
   const char *   fElems
 
fU
 
FreeProc fFreeProc
 
void * fFreeProcContext
 

Friends

class SkDataTableBuilder
 

Additional Inherited Members

- Protected Member Functions inherited from SkRefCntBase
void internal_dispose_restore_refcnt_to_1 () const
 Allow subclasses to call this if they've overridden internal_dispose so they can reset fRefCnt before the destructor is called or if they choose not to call the destructor (e.g. More...
 

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 Function Documentation

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

int SkDataTable::count ( ) const
inline

Return the number of entries in the table.

0 for an empty table

bool SkDataTable::isEmpty ( ) const
inline

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

has no entries).

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.
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.

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