HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_AIFSharedDictTuple Class Referenceabstract

A specialization of GA_AIFDictTuple to access "shared strings". More...

#include <GA_AIFSharedDictTuple.h>

Classes

class  iterator
 Class to iterate over all the options in the shared options table. More...
 

Public Member Functions

 GA_AIFSharedDictTuple ()
 
virtual ~GA_AIFSharedDictTuple ()
 
virtual bool getStatistics (const GA_Attribute *attrib, GA_DictTableStatistics &stats) const =0
 Query information about the string storage. More...
 
virtual bool compactStorage (GA_Attribute *attrib) const =0
 Compact the string storage. More...
 
virtual bool extractDicts (const GA_Attribute *attrib, UT_Array< UT_OptionsHolder > &options, UT_IntArray &handles) const =0
 
virtual bool extractHandles (const GA_Attribute *attrib, UT_IntArray &handles) const =0
 
GA_Size getTableEntries (const GA_Attribute *attrib) const
 Return the number of entries in the shared string table. More...
 
virtual GA_DictIndexType validateTableHandle (const GA_Attribute *attrib, GA_DictIndexType index) const =0
 
virtual UT_OptionsHolder getTableDict (const GA_Attribute *attrib, GA_DictIndexType handle) const =0
 Get a string from the string table (without going through an attribute) More...
 
virtual GA_DictIndexType getTableHandle (const GA_Attribute *attrib, const UT_OptionsRef &opt) const =0
 
virtual UT_OptionsHolder getTableOrderedDict (const GA_Attribute *a, exint index) const =0
 
virtual bool replaceTableDict (GA_Attribute *attrib, GA_DictIndexType handle, const UT_OptionsHolder &opt) const =0
 
iterator begin (const GA_Attribute *a) const
 
iterator end () const
 
virtual int getTupleSize (const GA_Attribute *attrib) const =0
 Query the tuple size. More...
 
virtual bool setTupleSize (GA_Attribute *attrib, int size) const =0
 Set the tuple size. More...
 
UT_StringHolder getString (const GA_Attribute *attrib, GA_Offset offset, int component=0, bool onlyspaces=false) const
 
virtual UT_OptionsHolder getDict (const GA_Attribute *attrib, GA_Offset ai, int tuple_index=0) const
 Get a single string from the array for a single tuple of an element. More...
 
virtual GA_DictIndexType getHandle (const GA_Attribute *attrib, GA_Offset ai, int tuple_index=0) const =0
 Get the handle from the array for a single tuple of an element. More...
 
virtual bool getHandles (const GA_Attribute *attrib, GA_Offset ai, GA_DictIndexType *handles, int count, int start=0) const
 Get the full tuple of indices for a single element. More...
 
virtual bool setDict (GA_Attribute *attrib, GA_Offset ai, const UT_OptionsHolder &opt, int tuple_index) const
 Set a single component for a single element. More...
 
virtual bool setDict (GA_Attribute *attrib, const GA_Range &ai, const UT_OptionsHolder &opt, int tuple_index) const
 Set a single component for a range of elements. More...
 
virtual bool setHandle (GA_Attribute *attrib, GA_Offset ai, GA_DictIndexType handle, int tuple_index) const =0
 Set a single component for a single element. More...
 
virtual bool setHandle (GA_Attribute *attrib, const GA_Range &ai, GA_DictIndexType handle, int tuple_index) const
 Set a single component for a range of elements. More...
 
virtual bool setHandles (GA_Attribute *attrib, GA_Offset ai, const GA_DictIndexType *handles, int count, int start=0) const
 Set multiple components for a single element. More...
 
virtual bool setHandles (GA_Attribute *attrib, const GA_Range &ai, const GA_DictIndexType *handles, int count, int start=0) const
 Set multiple components for a range of elements. More...
 

Protected Member Functions

virtual GA_DictIndexType addDictReference (GA_Attribute *attribute, const UT_OptionsHolder &opt) const =0
 Add (or increment) reference to a string. More...
 
virtual void delHandleReference (GA_Attribute *attribute, GA_DictIndexType handle) const =0
 Decrement reference to a handle. More...
 

Detailed Description

A specialization of GA_AIFDictTuple to access "shared strings".

This class provides the interface to access string table data. Each attribute type may provide this interface if it makes sense.

Definition at line 59 of file GA_AIFSharedDictTuple.h.

Constructor & Destructor Documentation

GA_AIFSharedDictTuple::GA_AIFSharedDictTuple ( )
virtual GA_AIFSharedDictTuple::~GA_AIFSharedDictTuple ( )
virtual

Member Function Documentation

virtual GA_DictIndexType GA_AIFSharedDictTuple::addDictReference ( GA_Attribute attribute,
const UT_OptionsHolder opt 
) const
protectedpure virtual

Add (or increment) reference to a string.

iterator GA_AIFSharedDictTuple::begin ( const GA_Attribute a) const
inline

Definition at line 223 of file GA_AIFSharedDictTuple.h.

virtual bool GA_AIFSharedDictTuple::compactStorage ( GA_Attribute attrib) const
pure virtual

Compact the string storage.

virtual void GA_AIFSharedDictTuple::delHandleReference ( GA_Attribute attribute,
GA_DictIndexType  handle 
) const
protectedpure virtual

Decrement reference to a handle.

iterator GA_AIFSharedDictTuple::end ( void  ) const
inline

Definition at line 225 of file GA_AIFSharedDictTuple.h.

virtual bool GA_AIFSharedDictTuple::extractDicts ( const GA_Attribute attrib,
UT_Array< UT_OptionsHolder > &  options,
UT_IntArray handles 
) const
pure virtual

Extract data from the string table. This will extract all the unique strings which are referenced by the attribute. The string handles are guaranteed to be in ascending order, but may or may not be contiguous.

virtual bool GA_AIFSharedDictTuple::extractHandles ( const GA_Attribute attrib,
UT_IntArray handles 
) const
pure virtual

Extract all of the unique string handles of the attribute. The string handles are guaranteed to be in ascending order, but may or may not be contiguous.

virtual UT_OptionsHolder GA_AIFSharedDictTuple::getDict ( const GA_Attribute attrib,
GA_Offset  ai,
int  tuple_index = 0 
) const
virtual

Get a single string from the array for a single tuple of an element.

virtual GA_DictIndexType GA_AIFSharedDictTuple::getHandle ( const GA_Attribute attrib,
GA_Offset  ai,
int  tuple_index = 0 
) const
pure virtual

Get the handle from the array for a single tuple of an element.

virtual bool GA_AIFSharedDictTuple::getHandles ( const GA_Attribute attrib,
GA_Offset  ai,
GA_DictIndexType handles,
int  count,
int  start = 0 
) const
virtual

Get the full tuple of indices for a single element.

virtual bool GA_AIFSharedDictTuple::getStatistics ( const GA_Attribute attrib,
GA_DictTableStatistics stats 
) const
pure virtual

Query information about the string storage.

UT_StringHolder GA_AIFSharedDictTuple::getString ( const GA_Attribute attrib,
GA_Offset  offset,
int  component = 0,
bool  onlyspaces = false 
) const

Get a string version to save writing marshalling code This lets you use this AIF in string-aware code and get sensible outputs. JSON normally has returns and tabs for formatting, onlyspaces will collapse these for a more compact output.

virtual UT_OptionsHolder GA_AIFSharedDictTuple::getTableDict ( const GA_Attribute attrib,
GA_DictIndexType  handle 
) const
pure virtual

Get a string from the string table (without going through an attribute)

GA_Size GA_AIFSharedDictTuple::getTableEntries ( const GA_Attribute attrib) const
inline

Return the number of entries in the shared string table.

Definition at line 92 of file GA_AIFSharedDictTuple.h.

virtual GA_DictIndexType GA_AIFSharedDictTuple::getTableHandle ( const GA_Attribute attrib,
const UT_OptionsRef opt 
) const
pure virtual

Get the handle (index) corresponding to the given string, returning -1 if none.

virtual UT_OptionsHolder GA_AIFSharedDictTuple::getTableOrderedDict ( const GA_Attribute a,
exint  index 
) const
pure virtual

GA_DictIndexType indices may not be contiguous, this method allows you to get a string given an ordered index. Strings will be defined for all contiguous strings. This may be an expensive operation, it's better to access strings by their index if possible.

This method will return a NULL pointer past the end of the string table

virtual int GA_AIFSharedDictTuple::getTupleSize ( const GA_Attribute attrib) const
pure virtual

Query the tuple size.

virtual bool GA_AIFSharedDictTuple::replaceTableDict ( GA_Attribute attrib,
GA_DictIndexType  handle,
const UT_OptionsHolder opt 
) const
pure virtual

Replace a string in the shared string table with a new value. Warning, it's possible that the table will "collapse" after the replacement. For example:

table := [ "foo", "bar" ]
table.replaceString(1, "foo") # Replace "bar" with "foo"
table := [ "foo" ]

In the above example, all elements which originally referenced "bar" will now reference "foo". This means that trying to swap two values will not work as expected.

virtual bool GA_AIFSharedDictTuple::setDict ( GA_Attribute attrib,
GA_Offset  ai,
const UT_OptionsHolder opt,
int  tuple_index 
) const
virtual

Set a single component for a single element.

virtual bool GA_AIFSharedDictTuple::setDict ( GA_Attribute attrib,
const GA_Range ai,
const UT_OptionsHolder opt,
int  tuple_index 
) const
virtual

Set a single component for a range of elements.

virtual bool GA_AIFSharedDictTuple::setHandle ( GA_Attribute attrib,
GA_Offset  ai,
GA_DictIndexType  handle,
int  tuple_index 
) const
pure virtual

Set a single component for a single element.

virtual bool GA_AIFSharedDictTuple::setHandle ( GA_Attribute attrib,
const GA_Range ai,
GA_DictIndexType  handle,
int  tuple_index 
) const
virtual

Set a single component for a range of elements.

virtual bool GA_AIFSharedDictTuple::setHandles ( GA_Attribute attrib,
GA_Offset  ai,
const GA_DictIndexType handles,
int  count,
int  start = 0 
) const
virtual

Set multiple components for a single element.

virtual bool GA_AIFSharedDictTuple::setHandles ( GA_Attribute attrib,
const GA_Range ai,
const GA_DictIndexType handles,
int  count,
int  start = 0 
) const
virtual

Set multiple components for a range of elements.

virtual bool GA_AIFSharedDictTuple::setTupleSize ( GA_Attribute attrib,
int  size 
) const
pure virtual

Set the tuple size.

virtual GA_DictIndexType GA_AIFSharedDictTuple::validateTableHandle ( const GA_Attribute attrib,
GA_DictIndexType  index 
) const
pure virtual

It's possible that there are invalid handle indexes mixed with the valid handles. When iterating over all the handles, you can call validateTableHandle() which will ensure that there's a string associated with the given handle.


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