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

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

#include <GA_AIFSharedStringArray.h>

Classes

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

Public Member Functions

 GA_AIFSharedStringArray ()
 
virtual ~GA_AIFSharedStringArray ()
 
virtual bool getStatistics (const GA_Attribute *attrib, GA_StringTableStatistics &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 extractStrings (const GA_Attribute *attrib, UT_StringArray &strings, 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_StringIndexType validateTableHandle (const GA_Attribute *attrib, GA_StringIndexType index) const =0
 
virtual const char * getTableString (const GA_Attribute *attrib, GA_StringIndexType handle) const =0
 Get a string from the string table (without going through an attribute) More...
 
virtual GA_StringIndexType getTableHandle (const GA_Attribute *attrib, const char *string) const =0
 
virtual const char * getTableOrderedString (const GA_Attribute *a, exint index) const =0
 
virtual bool replaceTableString (GA_Attribute *attrib, GA_StringIndexType handle, const char *string) const =0
 
iterator begin (const GA_Attribute *a) const
 
iterator end () const
 
virtual int getTupleSize (const GA_Attribute *attrib) const =0
 
virtual GA_Storage getStorage (const GA_Attribute *attrib) const =0
 
virtual void getString (const GA_Attribute *attribute, GA_Offset offset, UT_StringArray &strings) const =0
 Get a single string from the array for a single tuple of an element. More...
 
virtual void getString (const GA_Attribute *attribute, GA_Offset offset, UT_Array< UT_StringHolder > &strings) const =0
 
virtual void getStringIndex (const GA_Attribute *attribute, GA_Offset offset, UT_Array< GA_StringIndexType > &indices) const =0
 Get the handle from the array for a single tuple of an element. More...
 
virtual void setString (GA_Attribute *attribute, GA_Offset offset, const UT_StringArray &strings) const =0
 Set a single component for a single element. More...
 
virtual void setString (GA_Attribute *attribute, GA_Offset offset, const UT_Array< UT_StringHolder > &strings) const =0
 
virtual void setStringIndex (GA_Attribute *attribute, GA_Offset offset, const UT_Array< GA_StringIndexType > &indices) const =0
 Set a single component for a range of elements. More...
 
virtual exint arraySize (const GA_Attribute *atr, GA_Offset off) const =0
 Return the size of the array for the GA_Offset. More...
 
bool get (const GA_Attribute *attrib, GA_Offset o, UT_StringArray &v) const
 
bool set (GA_Attribute *attrib, GA_Offset o, const UT_StringArray &v) const
 
virtual exint findMaximumArrayLength (const GA_Attribute *attrib) const =0
 

Protected Member Functions

virtual GA_StringIndexType addStringReference (GA_Attribute *attribute, const char *string) const =0
 Add (or increment) reference to a string. More...
 
virtual void delHandleReference (GA_Attribute *attribute, GA_StringIndexType handle) const =0
 Decrement reference to a handle. More...
 

Detailed Description

A specialization of GA_AIFStringArray 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 34 of file GA_AIFSharedStringArray.h.

Constructor & Destructor Documentation

GA_AIFSharedStringArray::GA_AIFSharedStringArray ( )
virtual GA_AIFSharedStringArray::~GA_AIFSharedStringArray ( )
virtual

Member Function Documentation

virtual GA_StringIndexType GA_AIFSharedStringArray::addStringReference ( GA_Attribute attribute,
const char *  string 
) const
protectedpure virtual

Add (or increment) reference to a string.

virtual exint GA_AIFSharedStringArray::arraySize ( const GA_Attribute atr,
GA_Offset  off 
) const
pure virtual

Return the size of the array for the GA_Offset.

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

Definition at line 203 of file GA_AIFSharedStringArray.h.

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

Compact the string storage.

virtual void GA_AIFSharedStringArray::delHandleReference ( GA_Attribute attribute,
GA_StringIndexType  handle 
) const
protectedpure virtual

Decrement reference to a handle.

iterator GA_AIFSharedStringArray::end ( void  ) const
inline

Definition at line 205 of file GA_AIFSharedStringArray.h.

virtual bool GA_AIFSharedStringArray::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 bool GA_AIFSharedStringArray::extractStrings ( const GA_Attribute attrib,
UT_StringArray strings,
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 exint GA_AIFSharedStringArray::findMaximumArrayLength ( const GA_Attribute attrib) const
pure virtual

Return the length of longest array

bool GA_AIFSharedStringArray::get ( const GA_Attribute attrib,
GA_Offset  o,
UT_StringArray v 
) const
inline

Get a UT_StringArray at specific GA_Offset. This is an alias for getString() so that we can treat this AIF similar to GA_AIFNumericArray.

Definition at line 244 of file GA_AIFSharedStringArray.h.

virtual bool GA_AIFSharedStringArray::getStatistics ( const GA_Attribute attrib,
GA_StringTableStatistics stats 
) const
pure virtual

Query information about the string storage.

virtual GA_Storage GA_AIFSharedStringArray::getStorage ( const GA_Attribute attrib) const
pure virtual
virtual void GA_AIFSharedStringArray::getString ( const GA_Attribute attribute,
GA_Offset  offset,
UT_StringArray strings 
) const
pure virtual

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

virtual void GA_AIFSharedStringArray::getString ( const GA_Attribute attribute,
GA_Offset  offset,
UT_Array< UT_StringHolder > &  strings 
) const
pure virtual
virtual void GA_AIFSharedStringArray::getStringIndex ( const GA_Attribute attribute,
GA_Offset  offset,
UT_Array< GA_StringIndexType > &  indices 
) const
pure virtual

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

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

Return the number of entries in the shared string table.

Definition at line 72 of file GA_AIFSharedStringArray.h.

virtual GA_StringIndexType GA_AIFSharedStringArray::getTableHandle ( const GA_Attribute attrib,
const char *  string 
) const
pure virtual

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

virtual const char* GA_AIFSharedStringArray::getTableOrderedString ( const GA_Attribute a,
exint  index 
) const
pure virtual

GA_StringIndexType 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 const char* GA_AIFSharedStringArray::getTableString ( const GA_Attribute attrib,
GA_StringIndexType  handle 
) const
pure virtual

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

virtual int GA_AIFSharedStringArray::getTupleSize ( const GA_Attribute attrib) const
pure virtual
virtual bool GA_AIFSharedStringArray::replaceTableString ( GA_Attribute attrib,
GA_StringIndexType  handle,
const char *  string 
) 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.

bool GA_AIFSharedStringArray::set ( GA_Attribute attrib,
GA_Offset  o,
const UT_StringArray v 
) const
inline

Set a UT_StringArray at specific GA_Offset. This is an alias for setString() so that we can treat this AIF similar to GA_AIFNumericArray.

Definition at line 253 of file GA_AIFSharedStringArray.h.

virtual void GA_AIFSharedStringArray::setString ( GA_Attribute attribute,
GA_Offset  offset,
const UT_StringArray strings 
) const
pure virtual

Set a single component for a single element.

virtual void GA_AIFSharedStringArray::setString ( GA_Attribute attribute,
GA_Offset  offset,
const UT_Array< UT_StringHolder > &  strings 
) const
pure virtual
virtual void GA_AIFSharedStringArray::setStringIndex ( GA_Attribute attribute,
GA_Offset  offset,
const UT_Array< GA_StringIndexType > &  indices 
) const
pure virtual

Set a single component for a range of elements.

virtual GA_StringIndexType GA_AIFSharedStringArray::validateTableHandle ( const GA_Attribute attrib,
GA_StringIndexType  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: