HDK
|
A specialization of GA_AIFStringTuple to access "shared strings". More...
#include <GA_AIFSharedStringTuple.h>
Classes | |
class | iterator |
Class to iterate over all the strings in the shared string table. More... | |
class | StringBuffer |
Temporary container to hold references to multiple strings. More... | |
Public Member Functions | |
GA_AIFSharedStringTuple () | |
~GA_AIFSharedStringTuple () override | |
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 | extractStrings (const GA_Attribute *attrib, UT_StringArray &strings, UT_IntArray &handles, exint maxstrings) const =0 |
Stop after reaching a maximum. More... | |
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 |
int | getTupleSize (const GA_Attribute *attrib) const override=0 |
Query the tuple size. More... | |
bool | setTupleSize (GA_Attribute *attrib, int size) const override=0 |
Set the tuple size. More... | |
const char * | getString (const GA_Attribute *attrib, GA_Offset ai, int tuple_index=0) const override |
Get a single string from the array for a single tuple of an element. More... | |
virtual GA_StringIndexType | 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_StringIndexType *handles, int count, int start=0) const |
Get the full tuple of indices for a single element. More... | |
bool | setString (GA_Attribute *attrib, GA_Offset ai, const char *string, int tuple_index) const override |
Set a single component for a single element. More... | |
bool | setString (GA_Attribute *attrib, const GA_Range &ai, const char *string, int tuple_index) const override |
Set a single component for a range of elements. More... | |
virtual bool | setHandle (GA_Attribute *attrib, GA_Offset ai, GA_StringIndexType 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_StringIndexType 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_StringIndexType *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_StringIndexType *handles, int count, int start=0) const |
Set multiple components for a range of elements. More... | |
int | arrayGetLength (const GA_Attribute *attrib, GA_Offset element_index=GA_Offset(0)) const override |
int | arrayFindString (const GA_Attribute *attrib, const char *string, GA_Offset element_index=GA_Offset(0)) const override |
bool | arrayDestroyString (GA_Attribute *attrib, int string_index, GA_Offset element_index=GA_Offset(0)) const override |
StringBuffer | addStrings (GA_Attribute *attribute, const UT_StringArray &strings) const |
StringBuffer | addStrings (GA_Attribute *attribute, const UT_Array< const char * > &strings) const |
Public Member Functions inherited from GA_AIFStringTuple | |
GA_AIFStringTuple () | |
virtual | ~GA_AIFStringTuple () |
virtual bool | getStrings (const GA_Attribute *attrib, GA_Offset ai, UT_StringArray &strings, int count, int start=0) const |
Get the full tuple of string values for a single element. More... | |
virtual bool | setStrings (GA_Attribute *attrib, GA_Offset ai, const char **strings, int count, int start=0) const |
Set multiple components for a single element. More... | |
virtual bool | setStrings (GA_Attribute *attrib, const GA_Range &ai, const char **strings, int count, int start=0) const |
Set multiple components for a range of elements. More... | |
virtual bool | arrayReserve (GA_Attribute *attrib, int length) const |
Reserve space in the array. More... | |
virtual bool | arrayTruncate (GA_Attribute *attrib, int length) const |
Truncate the array to the given entries. More... | |
virtual int | arrayTrim (GA_Attribute *attrib) const |
virtual int | arrayAppendString (GA_Attribute *attrib, const char *string, GA_Offset element_index=GA_Offset(0)) const |
virtual int | arrayAppendUniqueString (GA_Attribute *attrib, const char *string, GA_Offset element_index=GA_Offset(0)) const |
virtual int | arrayGetMaxLength (const GA_Attribute *attrib, const GA_Range &range) const |
Find the maximum length of all elements in the range. More... | |
virtual const char * | arrayGetString (const GA_Attribute *attrib, int string_index, GA_Offset element_index=GA_Offset(0)) const |
virtual int | arrayGetStrings (UT_StringArray &strings, const GA_Attribute *attrib, GA_Offset element_index=GA_Offset(0)) const |
virtual int | arrayRemoveDuplicates (GA_Attribute *attrib, GA_Offset element_index=GA_Offset(0)) const |
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... | |
Friends | |
class | StringBuffer |
A specialization of GA_AIFStringTuple 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 60 of file GA_AIFSharedStringTuple.h.
GA_AIFSharedStringTuple::GA_AIFSharedStringTuple | ( | ) |
|
override |
|
protectedpure virtual |
Add (or increment) reference to a string.
StringBuffer GA_AIFSharedStringTuple::addStrings | ( | GA_Attribute * | attribute, |
const UT_StringArray & | strings | ||
) | const |
Method to add multiple strings in a batch process. The strings will be temporarily added to the attribute for as long as the StringBuffer exists. When the StringBuffer is deleted, the strings will be deleted from the attribute unless referenced by elements in the attribute array.
Information about the strings (i.e. the handles) can be retriefed from the StringBuffer. For example:
StringBuffer GA_AIFSharedStringTuple::addStrings | ( | GA_Attribute * | attribute, |
const UT_Array< const char * > & | strings | ||
) | const |
Method to add multiple strings in a batch process. The strings will be temporarily added to the attribute for as long as the StringBuffer exists. When the StringBuffer is deleted, the strings will be deleted from the attribute unless referenced by elements in the attribute array.
Information about the strings (i.e. the handles) can be retriefed from the StringBuffer. For example:
|
overridevirtual |
Array API, select functions can be more efficiently implemented using shared strings. Please see GA_AIFStringTuple for remainder of interface
Reimplemented from GA_AIFStringTuple.
|
overridevirtual |
Array API, select functions can be more efficiently implemented using shared strings. Please see GA_AIFStringTuple for remainder of interface
Reimplemented from GA_AIFStringTuple.
|
overridevirtual |
Array API, select functions can be more efficiently implemented using shared strings. Please see GA_AIFStringTuple for remainder of interface
Reimplemented from GA_AIFStringTuple.
|
inline |
Definition at line 231 of file GA_AIFSharedStringTuple.h.
|
pure virtual |
Compact the string storage.
|
protectedpure virtual |
Decrement reference to a handle.
Definition at line 233 of file GA_AIFSharedStringTuple.h.
|
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.
|
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.
|
pure virtual |
Stop after reaching a maximum.
|
pure virtual |
Get the handle from the array for a single tuple of an element.
|
virtual |
Get the full tuple of indices for a single element.
|
pure virtual |
Query information about the string storage.
|
overridevirtual |
Get a single string from the array for a single tuple of an element.
Implements GA_AIFStringTuple.
|
inline |
Return the number of entries in the shared string table.
Definition at line 98 of file GA_AIFSharedStringTuple.h.
|
pure virtual |
Get the handle (index) corresponding to the given string, returning -1 if none.
|
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
|
pure virtual |
Get a string from the string table (without going through an attribute)
|
overridepure virtual |
Query the tuple size.
Implements GA_AIFStringTuple.
|
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:
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.
|
pure virtual |
Set a single component for a single element.
|
virtual |
Set a single component for a range of elements.
|
virtual |
Set multiple components for a single element.
|
virtual |
Set multiple components for a range of elements.
|
overridevirtual |
Set a single component for a single element.
Implements GA_AIFStringTuple.
|
overridevirtual |
Set a single component for a range of elements.
Reimplemented from GA_AIFStringTuple.
|
overridepure virtual |
Set the tuple size.
Implements GA_AIFStringTuple.
|
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.
|
friend |
Definition at line 386 of file GA_AIFSharedStringTuple.h.