HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDG_AttributeRefT< Attribute, Holder > Class Template Reference

#include <PDG_AttributeRef.h>

+ Inheritance diagram for PDG_AttributeRefT< Attribute, Holder >:

Public Types

using Self = PDG_AttributeRefT< Attribute, Holder >
 

Public Member Functions

 PDG_AttributeRefT (Holder *holder, const UT_StringHolder &name, const PDG_AttributeOwner *owner, PDG_AttributeError error=PDG_AttributeError::eNone)
 
Holder * holder () const
 Returns the underlying attribute holder. More...
 
const Attributeattribute () const
 Returns a const pointer to the underlying attribute instance. More...
 
template<typename T >
const TattributeT () const
 
const Attributeoperator-> () const
 Returns a const pointer to the underlying attribute instance. More...
 
bool hasData () const
 Returns true if the contained attribute has any data. More...
 
bool isOwner () const
 Returns true if the contained attribute holder owns its data. More...
 
PDG_AttributeType type () const
 Returns the type of the contained attribute. More...
 
uint16 flags () const
 Returns the flags on the contained holder. More...
 
bool hasAnyFlags () const
 Returns true if the contained holder has any flags set. More...
 
bool hasFlag (PDG_AttributeFlag flag) const
 Returns true if the contained holder has the specified flag set. More...
 
bool hasFlags (uint16 flags) const
 Returns true if the contained holder has all of the specified flags set. More...
 
bool hasAnyFlags (uint16 flags) const
 Returns true if the contained holder has any of the specified flags set. More...
 
bool isNumeric () const
 Returns true if the attribute is numeric. More...
 
bool isArray () const
 Returns true if the attribute is an array. More...
 
bool hash (SYS_HashType &result, exint index, bool include_value, bool include_name, bool include_flags, UT_WorkBuffer &errors) const
 Returns a hash of the name, flags and values of the attribute. More...
 
PDG_AttributeCast asNumber (fpreal &number, exint &query_index, const PDG_AttributeQuery &query, int index, bool has_component) const
 
PDG_AttributeCast asNumber (fpreal &number, int index) const
 
template<typename Array >
PDG_AttributeCast asNumbers (Array &array) const
 
PDG_AttributeCast asFilePath (UT_StringHolder &path, int index, const UT_StringHolder &tag, const PDG_Scheduler *scheduler, bool localize)
 
PDG_AttributeCast asFilePathValues (UT_WorkBuffer &buffer, const UT_StringHolder &tag, const PDG_Scheduler *scheduler, bool localize)
 
PDG_AttributeCast asFile (PDG_File &file, int index, const UT_StringHolder &tag=UT_StringHolder::theEmptyString, PDG_File::Hash hash=0, bool own=false) const
 
PDG_AttributeCast asString (UT_WorkBuffer &buffer, exint &query_index, const PDG_AttributeQuery &query, int index, int pad, bool has_component) const
 
PDG_AttributeCast asString (UT_WorkBuffer &buffer, int index, int pad=0) const
 
PDG_AttributeCast asStrings (UT_StringArray &array) const
 
PDG_AttributeCast asStringValues (UT_WorkBuffer &buffer, int pad=0) const
 Prints the values contained in the attribute to space-separated string. More...
 
PDG_AttributeCast asOptions (UT_Options &options, PDG_AttributeOverwrite overwrite) const
 
PDG_AttributeCast asOptions (UT_Options &options, const UT_StringHolder &key, PDG_AttributeOverwrite overwrite) const
 
int size () const
 Returns the size of the data stored in the attribute. More...
 
- Public Member Functions inherited from PDG_AttributeRef
 PDG_AttributeRef (const UT_StringHolder &name, const PDG_AttributeOwner *owner, PDG_AttributeError error=PDG_AttributeError::eNone)
 
 operator bool () const
 Returns true if the handle is valid. More...
 
bool isValid () const
 Returns true if the handle is valid. More...
 
PDG_AttributeError error () const
 Returns the error state of the handle. More...
 
const UT_StringHoldername () const
 Returns the name of the attribute referenced by this attrib ref. More...
 
const PDG_AttributeOwnerowner () const
 Returns the PDG_AttributeOwner that owns the underlying attribute. More...
 
bool validate (UT_WorkBuffer &buffer) const
 
bool validate (const PDG_Node *node, PDG_AttributeErrorLevel level) const
 

Protected Attributes

Holder * myHolder
 
- Protected Attributes inherited from PDG_AttributeRef
UT_StringHolder myName
 
const PDG_AttributeOwnermyOwner
 
PDG_AttributeError myError
 

Additional Inherited Members

- Static Public Member Functions inherited from PDG_AttributeRef
static bool attributeError (UT_WorkBuffer &buffer, PDG_AttributeError error, const UT_StringHolder &attrib_name, const PDG_AttributeOwner *owner=nullptr)
 
static void attributeModified (const PDG_AttributeOwner *owner, PDG_AttributeType attrib_type, const UT_StringHolder &attrib_name)
 Emits events when the attribute is modified. More...
 
static UT_StringHolder localizePath (const UT_StringHolder &path, const PDG_Scheduler *scheduler)
 Localizes a path with the specified scheduler. More...
 

Detailed Description

template<typename Attribute, typename Holder>
class PDG_AttributeRefT< Attribute, Holder >

Base class for templated attribute references

Definition at line 117 of file PDG_AttributeRef.h.

Member Typedef Documentation

template<typename Attribute, typename Holder>
using PDG_AttributeRefT< Attribute, Holder >::Self = PDG_AttributeRefT<Attribute, Holder>

Definition at line 120 of file PDG_AttributeRef.h.

Constructor & Destructor Documentation

template<typename Attribute, typename Holder>
PDG_AttributeRefT< Attribute, Holder >::PDG_AttributeRefT ( Holder *  holder,
const UT_StringHolder name,
const PDG_AttributeOwner owner,
PDG_AttributeError  error = PDG_AttributeError::eNone 
)
inlineexplicit

Definition at line 123 of file PDG_AttributeRef.h.

Member Function Documentation

template<typename Attribute, typename Holder>
PDG_AttributeCast PDG_AttributeRefT< Attribute, Holder >::asFile ( PDG_File file,
int  index,
const UT_StringHolder tag = UT_StringHolder::theEmptyString,
PDG_File::Hash  hash = 0,
bool  own = false 
) const
inline

Casts the value contained in the attribute to a PDG_File object. Only valid for string, file and PyObject attribute types

Definition at line 429 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
PDG_AttributeCast PDG_AttributeRefT< Attribute, Holder >::asFilePath ( UT_StringHolder path,
int  index,
const UT_StringHolder tag,
const PDG_Scheduler scheduler,
bool  localize 
)
inline

Returns a file path from the attribute, using the specified index and tag filter. If a scheduler is supplied, the path is localized with the scheduler. Only valid for files and strings. For string attributes the tag is ignored and assumed to match

Definition at line 332 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
PDG_AttributeCast PDG_AttributeRefT< Attribute, Holder >::asFilePathValues ( UT_WorkBuffer buffer,
const UT_StringHolder tag,
const PDG_Scheduler scheduler,
bool  localize 
)
inline

Returns a space-separate string of file path(s) from the attribute, using all values in the attribute and the specified tag filter. If a scheduler is supplied, the paths are localized with the scheduler. Only valid for files and strings. For string attributes the tag is ignored and assumed to match

Definition at line 377 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
PDG_AttributeCast PDG_AttributeRefT< Attribute, Holder >::asNumber ( fpreal number,
exint query_index,
const PDG_AttributeQuery query,
int  index,
bool  has_component 
) const
inline

Casts the value contained in the attribute at the particular index to a numeric value, by looking up the value with the query string. Falls a regular cast if query strings aren't supported

Definition at line 251 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
PDG_AttributeCast PDG_AttributeRefT< Attribute, Holder >::asNumber ( fpreal number,
int  index 
) const
inline

Casts the value contained in the attribute at the particular index to a numeric value, if possible.

Definition at line 277 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
template<typename Array >
PDG_AttributeCast PDG_AttributeRefT< Attribute, Holder >::asNumbers ( Array array) const
inline

Casts the value contained in the attribute to a numeric array, if possible.

Definition at line 308 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
PDG_AttributeCast PDG_AttributeRefT< Attribute, Holder >::asOptions ( UT_Options options,
PDG_AttributeOverwrite  overwrite 
) const
inline

Imports the attribute data in the ref into a UT_Options instance using the name of this attribute as the key string

Definition at line 787 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
PDG_AttributeCast PDG_AttributeRefT< Attribute, Holder >::asOptions ( UT_Options options,
const UT_StringHolder key,
PDG_AttributeOverwrite  overwrite 
) const
inline

Imports the attribute data in the ref into an UT_Options instance using the specified key string

Definition at line 796 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
PDG_AttributeCast PDG_AttributeRefT< Attribute, Holder >::asString ( UT_WorkBuffer buffer,
exint query_index,
const PDG_AttributeQuery query,
int  index,
int  pad,
bool  has_component 
) const
inline

Casts the value contained in the attribute at the particular index to a string value, by looking up the value with the query string. Falls a regular cast if query strings aren't supported

Definition at line 496 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
PDG_AttributeCast PDG_AttributeRefT< Attribute, Holder >::asString ( UT_WorkBuffer buffer,
int  index,
int  pad = 0 
) const
inline

Casts the value contained in the attribute at the particular index to a string value, if possible.

Definition at line 523 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
PDG_AttributeCast PDG_AttributeRefT< Attribute, Holder >::asStrings ( UT_StringArray array) const
inline

Casts the value contained in the attribute to a string array, if possible.

Definition at line 614 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
PDG_AttributeCast PDG_AttributeRefT< Attribute, Holder >::asStringValues ( UT_WorkBuffer buffer,
int  pad = 0 
) const
inline

Prints the values contained in the attribute to space-separated string.

Definition at line 691 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
const Attribute* PDG_AttributeRefT< Attribute, Holder >::attribute ( ) const
inline

Returns a const pointer to the underlying attribute instance.

Definition at line 140 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
template<typename T >
const T* PDG_AttributeRefT< Attribute, Holder >::attributeT ( ) const
inline

Returns a const pointer to the underlying attribute instance, casted to the specified type

Definition at line 147 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
uint16 PDG_AttributeRefT< Attribute, Holder >::flags ( ) const
inline

Returns the flags on the contained holder.

Definition at line 177 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
bool PDG_AttributeRefT< Attribute, Holder >::hasAnyFlags ( ) const
inline

Returns true if the contained holder has any flags set.

Definition at line 183 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
bool PDG_AttributeRefT< Attribute, Holder >::hasAnyFlags ( uint16  flags) const
inline

Returns true if the contained holder has any of the specified flags set.

Definition at line 201 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
bool PDG_AttributeRefT< Attribute, Holder >::hasData ( ) const
inline

Returns true if the contained attribute has any data.

Definition at line 159 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
bool PDG_AttributeRefT< Attribute, Holder >::hasFlag ( PDG_AttributeFlag  flag) const
inline

Returns true if the contained holder has the specified flag set.

Definition at line 189 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
bool PDG_AttributeRefT< Attribute, Holder >::hasFlags ( uint16  flags) const
inline

Returns true if the contained holder has all of the specified flags set.

Definition at line 195 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
bool PDG_AttributeRefT< Attribute, Holder >::hash ( SYS_HashType result,
exint  index,
bool  include_value,
bool  include_name,
bool  include_flags,
UT_WorkBuffer errors 
) const
inline

Returns a hash of the name, flags and values of the attribute.

Definition at line 220 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
Holder* PDG_AttributeRefT< Attribute, Holder >::holder ( ) const
inline

Returns the underlying attribute holder.

Definition at line 134 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
bool PDG_AttributeRefT< Attribute, Holder >::isArray ( ) const
inline

Returns true if the attribute is an array.

Definition at line 214 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
bool PDG_AttributeRefT< Attribute, Holder >::isNumeric ( ) const
inline

Returns true if the attribute is numeric.

Definition at line 207 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
bool PDG_AttributeRefT< Attribute, Holder >::isOwner ( ) const
inline

Returns true if the contained attribute holder owns its data.

Definition at line 165 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
const Attribute* PDG_AttributeRefT< Attribute, Holder >::operator-> ( ) const
inline

Returns a const pointer to the underlying attribute instance.

Definition at line 153 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
int PDG_AttributeRefT< Attribute, Holder >::size ( void  ) const
inline

Returns the size of the data stored in the attribute.

Definition at line 922 of file PDG_AttributeRef.h.

template<typename Attribute, typename Holder>
PDG_AttributeType PDG_AttributeRefT< Attribute, Holder >::type ( ) const
inline

Returns the type of the contained attribute.

Definition at line 171 of file PDG_AttributeRef.h.

Member Data Documentation

template<typename Attribute, typename Holder>
Holder* PDG_AttributeRefT< Attribute, Holder >::myHolder
protected

Definition at line 974 of file PDG_AttributeRef.h.


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