HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VOP_TypeInfo Class Reference

#include <VOP_TypeInfo.h>

Public Member Functions

void setTypeInfoFromType (VOP_Type type)
 
const UT_StringHoldergetTypeName () const
 Returns the official type name. More...
 
VOP_TypeDefinitionHandle getTypeDefinitionHandle () const
 Returns the actual type definition for the type represented by object. More...
 
void conditionType (const VOP_Language &language)
 
bool canDirectlyAssign (const VOP_TypeInfo &src_type, const VOP_Language *language=nullptr) const
 
bool isValid () const
 Returns true if the type is valid. More...
 
bool isArray () const
 Returns true if the type is an array. More...
 
VOP_TypeInfo getArrayElementTypeInfo () const
 Returns the type of the array element, if this type is an array. More...
 
bool isStructLike () const
 Returns true for sturct and class custom type. More...
 
void getDescriptionString (UT_String &description) const
 
UT_StringHolder getDescriptionString () const
 
void getTokenString (UT_String &token) const
 
UT_StringHolder getTokenString () const
 
void setFromTokenString (const char *token_or_description)
 
 VOP_TypeInfo (VOP_Type type=VOP_TYPE_UNDEF, const char *type_name=NULL)
 
 ~VOP_TypeInfo ()
 
void setType (VOP_Type type, VOP_Type raw_type=VOP_TYPE_UNDEF, const char *type_name=NULL)
 
void setType (VOP_Type type, const char *type_name)
 
VOP_Type getType () const
 Returns the type enumeration value. More...
 
VOP_Type getRawType () const
 Returns the type enumeration value. More...
 
VOP_Type getBaseType () const
 Returns the type enumeration value. More...
 
bool operator== (const VOP_TypeInfo &other) const
 Comparison operators. More...
 
bool operator!= (const VOP_TypeInfo &other) const
 Comparison operators. More...
 

Static Public Member Functions

static const VOP_TypeInfogetUndefinedTypeInfo ()
 Returns a type info that represents an undefined type. More...
 
enum  { UNKNOWN_ARRAY_LENGTH = -1 }
 Sets and gets the array length. More...
 
void setArrayLength (int length)
 Sets and gets the array length. More...
 
int getArrayLength () const
 Sets and gets the array length. More...
 
bool isFixedArrayLength () const
 Sets and gets the array length. More...
 

Detailed Description

Class abstracting VOP variable and connector types. Unlike the basic VOP_Type enum, this class can represent and refer to any type, including structs and custom types.

Examples:
VOP/VOP_CustomContext.C, VOP/VOP_CustomContext.h, VOP/VOP_Switch.C, and VOP/VOP_Switch.h.

Definition at line 39 of file VOP_TypeInfo.h.

Member Enumeration Documentation

anonymous enum

Sets and gets the array length.

Enumerator
UNKNOWN_ARRAY_LENGTH 

Definition at line 87 of file VOP_TypeInfo.h.

Constructor & Destructor Documentation

VOP_TypeInfo::VOP_TypeInfo ( VOP_Type  type = VOP_TYPE_UNDEF,
const char *  type_name = NULL 
)
explicit

A constructor and a destructor.

VOP_TypeInfo::~VOP_TypeInfo ( )

A constructor and a destructor.

Member Function Documentation

bool VOP_TypeInfo::canDirectlyAssign ( const VOP_TypeInfo src_type,
const VOP_Language language = nullptr 
) const

Returns true if a variable of this type can be directly assigned a value of the src_type type, without any explicit conversion.

void VOP_TypeInfo::conditionType ( const VOP_Language language)

Language will condition the type to an equivalent base type, which is useful for comparing types to test assignment compatibility (eg, color and vector). Makes the type and raw type equal to the type conditioned by the language.

Examples:
VOP/VOP_Switch.C.
VOP_TypeInfo VOP_TypeInfo::getArrayElementTypeInfo ( ) const

Returns the type of the array element, if this type is an array.

int VOP_TypeInfo::getArrayLength ( ) const
inline

Sets and gets the array length.

Definition at line 90 of file VOP_TypeInfo.h.

VOP_Type VOP_TypeInfo::getBaseType ( ) const
inline

Returns the type enumeration value.

Definition at line 75 of file VOP_TypeInfo.h.

void VOP_TypeInfo::getDescriptionString ( UT_String description) const

Returns a type description used for labeling node inputs, outputs, and other places with a legible name. Eg, "int", "uniform float", "vector array", and "mystruct" (for 'struct mystruct' type).

UT_StringHolder VOP_TypeInfo::getDescriptionString ( ) const
inline

Definition at line 132 of file VOP_TypeInfo.h.

VOP_Type VOP_TypeInfo::getRawType ( ) const
inline

Returns the type enumeration value.

Definition at line 73 of file VOP_TypeInfo.h.

void VOP_TypeInfo::getTokenString ( UT_String token) const

Returns a string that encodes the type information into a single-worded string. Eg, "int", "ufloat", "vectora", "struct_mystruct" (for 'struct mystruct' type).

UT_StringHolder VOP_TypeInfo::getTokenString ( ) const
inline

Definition at line 143 of file VOP_TypeInfo.h.

VOP_Type VOP_TypeInfo::getType ( ) const
inline

Returns the type enumeration value.

Definition at line 71 of file VOP_TypeInfo.h.

VOP_TypeDefinitionHandle VOP_TypeInfo::getTypeDefinitionHandle ( ) const

Returns the actual type definition for the type represented by object.

const UT_StringHolder& VOP_TypeInfo::getTypeName ( ) const
inline

Returns the official type name.

Definition at line 80 of file VOP_TypeInfo.h.

static const VOP_TypeInfo& VOP_TypeInfo::getUndefinedTypeInfo ( )
static

Returns a type info that represents an undefined type.

bool VOP_TypeInfo::isArray ( ) const

Returns true if the type is an array.

bool VOP_TypeInfo::isFixedArrayLength ( ) const
inline

Sets and gets the array length.

Definition at line 92 of file VOP_TypeInfo.h.

bool VOP_TypeInfo::isStructLike ( ) const

Returns true for sturct and class custom type.

bool VOP_TypeInfo::isValid ( ) const

Returns true if the type is valid.

bool VOP_TypeInfo::operator!= ( const VOP_TypeInfo other) const

Comparison operators.

bool VOP_TypeInfo::operator== ( const VOP_TypeInfo other) const

Comparison operators.

void VOP_TypeInfo::setArrayLength ( int  length)
inline

Sets and gets the array length.

Definition at line 88 of file VOP_TypeInfo.h.

void VOP_TypeInfo::setFromTokenString ( const char *  token_or_description)

Sets the type info from the string representation of that type. The string representation should be compatible with the strings returned from getDescriptionString() or getTokenString() above. Note, the struct types can be only deduced from strings compatible with getTokenString(), or if str is "struct" (unnamed struct).

void VOP_TypeInfo::setType ( VOP_Type  type,
VOP_Type  raw_type = VOP_TYPE_UNDEF,
const char *  type_name = NULL 
)

Sets a new type and additional data for the type info.

Examples:
VOP/VOP_CustomContext.C, and VOP/VOP_Switch.C.
void VOP_TypeInfo::setType ( VOP_Type  type,
const char *  type_name 
)

Sets a new type and additional data for the type info.

void VOP_TypeInfo::setTypeInfoFromType ( VOP_Type  type)
inline

Utility function that converts VOP_Type into a VOP_TypeInfo. It is used during transition from VOP_Type to VOP_TypeInfo to mark the places that should abandon VOP_Type in favour of VOP_TypeInfo, but whose conversion is quite involved and likely requires lengthy sweeps, and thus is postponed untill later phases.

Definition at line 58 of file VOP_TypeInfo.h.


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