|
HDK
|
#include <UT_Variant.h>
Classes | |
| struct | IsCompoundType |
| struct | IsConvertibleType |
| struct | IsTrivialType |
| struct | TypeConversion |
| struct | TypeConversion< const char * > |
| struct | TypeConversion< fpreal32 > |
| struct | TypeConversion< int32 > |
| struct | TypeConversion< uint32 > |
| struct | TypeConversion< UT_Matrix2F > |
| struct | TypeConversion< UT_Matrix3F > |
| struct | TypeConversion< UT_Matrix4F > |
| struct | TypeConversion< UT_Vector2F > |
| struct | TypeConversion< UT_Vector3F > |
| struct | TypeConversion< UT_Vector4F > |
| struct | TypeInfo |
Public Types | |
| enum | Type { Type::Unknown, Null, Type::Bool, Type::Int, Type::UInt, Type::Float, Type::String, Type::Vector2, Type::Vector3, Type::Vector4, Type::Matrix2, Type::Matrix3, Type::Matrix4, Type::Pointer, Type::Array, Type::Map } |
| enum | NullType { Null, Null } |
Public Member Functions | |
| UT_Variant () | |
| Construct an unknown variant. More... | |
| UT_Variant (NullType) | |
| UT_Variant (bool v) | |
| Construct a boolean variant with the given value. More... | |
| UT_Variant (int32 v) | |
| Construct an integer variant with the given value. More... | |
| UT_Variant (int64 v) | |
| Construct an integer variant with the given value. More... | |
| UT_Variant (uint32 v) | |
| Construct an unsigned integer variant with the given value. More... | |
| UT_Variant (uint64 v) | |
| Construct an unsigned integer variant with the given value. More... | |
| UT_Variant (fpreal32 v) | |
| Construct a float variant with the given value. More... | |
| UT_Variant (fpreal64 v) | |
| Construct a float variant with the given value. More... | |
| UT_Variant (const char *v) | |
| Construct a string variant with the given value. More... | |
| UT_Variant (const UT_StringHolder &v) | |
Construct a Type::String variant with the given value. More... | |
| UT_Variant (const UT_StringRef &v) | |
Construct a Type::String variant with the given value. More... | |
| UT_Variant (const UT_Vector2F &v) | |
Construct a Type::Vector2 variant with the given value. More... | |
| UT_Variant (const UT_Vector2D &v) | |
Construct a Type::Vector2 variant with the given value. More... | |
| UT_Variant (const UT_Vector3F &v) | |
Construct a Type::Vector3 variant with the given value. More... | |
| UT_Variant (const UT_Vector3D &v) | |
Construct a Type::Vector3 variant with the given value. More... | |
| UT_Variant (const UT_Vector4F &v) | |
Construct a Type::Vector4 variant with the given value. More... | |
| UT_Variant (const UT_Vector4D &v) | |
Construct a Type::Vector4 variant with the given value. More... | |
| UT_Variant (const UT_Matrix2F &v) | |
Construct a Type::Matrix2 variant with the given value. More... | |
| UT_Variant (const UT_Matrix2D &v) | |
Construct a Type::Matrix2 variant with the given value. More... | |
| UT_Variant (const UT_Matrix3F &v) | |
Construct a Type::Matrix3 variant with the given value. More... | |
| UT_Variant (const UT_Matrix3D &v) | |
Construct a Type::Matrix3 variant with the given value. More... | |
| UT_Variant (const UT_Matrix4F &v) | |
Construct a Type::Matrix4 variant with the given value. More... | |
| UT_Variant (const UT_Matrix4D &v) | |
Construct a Type::Matrix4 variant with the given value. More... | |
| UT_Variant (void *v) | |
Construct a Type::Pointer variant with the given value. More... | |
| UT_Variant (const UT_VariantArray &v) | |
Construct a Type::Array variant with the given value. More... | |
| UT_Variant (UT_VariantArray &&v) | |
Construct a Type::Array variant with the given value. More... | |
| UT_Variant (const UT_VariantMap &v) | |
Construct a Type::Map variant with the given value. More... | |
| UT_Variant (UT_VariantMap &&v) | |
Construct a Type::Map variant with the given value. More... | |
| UT_Variant (const UT_Variant &v) | |
| Copy construct a variant with the given value. More... | |
| UT_Variant (UT_Variant &&v) | |
| Move construct a variant with the given value. More... | |
| ~UT_Variant () | |
| UT_Variant & | operator= (const UT_Variant &v) |
| UT_Variant & | operator= (UT_Variant &&v) |
| bool | operator== (const UT_Variant &v) const |
| Type | type () const |
| const char * | typeName () const |
| bool | convert (Type type) |
| void | setNull () |
| An explicit method of setting the variant type to null. More... | |
| template<typename T > | |
| void | set (const T &v) |
| template<typename T > | |
| std::enable_if< IsTrivialType < T >::value &&!IsConvertibleType< T > ::value, T >::type | get (bool &ok) const |
| template<typename T > | |
| std::enable_if< IsCompoundType < T >::value &&!IsConvertibleType< T > ::value, const T & >::type | get (bool &ok) const |
| template<typename T > | |
| std::enable_if<!IsTrivialType < T >::value &&!IsCompoundType < T >::value &&IsConvertibleType< T > ::value, T >::type | get (bool &ok) const |
| template<typename T > | |
| std::enable_if< IsTrivialType < T >::value &&!IsConvertibleType< T > ::value, T >::type | get () const |
| template<typename T > | |
| std::enable_if< IsCompoundType < T >::value &&!IsConvertibleType< T > ::value, const T & >::type | get () const |
| template<typename T > | |
| std::enable_if<!IsTrivialType < T >::value &&!IsCompoundType < T >::value &&IsConvertibleType< T > ::value, T >::type | get () const |
Static Public Member Functions | |
| static const char * | typeName (Type type) |
UT_Variant is a container that can hold a single value of many different types.
Definition at line 204 of file UT_Variant.h.
| enum UT_Variant::NullType |
A keystone type used to indicate that a variant should be initialized as a null variant.
| Enumerator | |
|---|---|
| Null | |
| Null |
A null variant. A null variant holds no value. |
Definition at line 230 of file UT_Variant.h.
|
strong |
| Enumerator | |
|---|---|
| Unknown |
Uninitialized variant. This is distinct from a null variant. |
| Null |
A null variant. A null variant holds no value. |
| Bool |
A boolean. |
| Int |
A 64-bit signed integer. |
| UInt |
A 64-bit unsigned integer. |
| Float |
A 64-bit float value. |
| String |
A shared string. |
| Vector2 |
|
| Vector3 |
|
| Vector4 |
|
| Matrix2 |
|
| Matrix3 |
|
| Matrix4 |
|
| Pointer |
An arbitrary |
| Array |
A |
| Map |
A |
Definition at line 208 of file UT_Variant.h.
|
inline |
Construct an unknown variant.
Definition at line 257 of file UT_Variant.h.
|
inline |
Construct a null variant. Call like so:
Definition at line 263 of file UT_Variant.h.
|
inline |
Construct a boolean variant with the given value.
Definition at line 266 of file UT_Variant.h.
|
inline |
Construct an integer variant with the given value.
Definition at line 269 of file UT_Variant.h.
|
inline |
Construct an integer variant with the given value.
Definition at line 272 of file UT_Variant.h.
|
inline |
Construct an unsigned integer variant with the given value.
Definition at line 275 of file UT_Variant.h.
|
inline |
Construct an unsigned integer variant with the given value.
Definition at line 278 of file UT_Variant.h.
|
inline |
Construct a float variant with the given value.
Definition at line 281 of file UT_Variant.h.
|
inline |
Construct a float variant with the given value.
Definition at line 284 of file UT_Variant.h.
| UT_Variant::UT_Variant | ( | const char * | v | ) |
Construct a string variant with the given value.
| UT_Variant::UT_Variant | ( | const UT_StringHolder & | v | ) |
Construct a Type::String variant with the given value.
| UT_Variant::UT_Variant | ( | const UT_StringRef & | v | ) |
Construct a Type::String variant with the given value.
| UT_Variant::UT_Variant | ( | const UT_Vector2F & | v | ) |
Construct a Type::Vector2 variant with the given value.
| UT_Variant::UT_Variant | ( | const UT_Vector2D & | v | ) |
Construct a Type::Vector2 variant with the given value.
| UT_Variant::UT_Variant | ( | const UT_Vector3F & | v | ) |
Construct a Type::Vector3 variant with the given value.
| UT_Variant::UT_Variant | ( | const UT_Vector3D & | v | ) |
Construct a Type::Vector3 variant with the given value.
| UT_Variant::UT_Variant | ( | const UT_Vector4F & | v | ) |
Construct a Type::Vector4 variant with the given value.
| UT_Variant::UT_Variant | ( | const UT_Vector4D & | v | ) |
Construct a Type::Vector4 variant with the given value.
| UT_Variant::UT_Variant | ( | const UT_Matrix2F & | v | ) |
Construct a Type::Matrix2 variant with the given value.
| UT_Variant::UT_Variant | ( | const UT_Matrix2D & | v | ) |
Construct a Type::Matrix2 variant with the given value.
| UT_Variant::UT_Variant | ( | const UT_Matrix3F & | v | ) |
Construct a Type::Matrix3 variant with the given value.
| UT_Variant::UT_Variant | ( | const UT_Matrix3D & | v | ) |
Construct a Type::Matrix3 variant with the given value.
| UT_Variant::UT_Variant | ( | const UT_Matrix4F & | v | ) |
Construct a Type::Matrix4 variant with the given value.
| UT_Variant::UT_Variant | ( | const UT_Matrix4D & | v | ) |
Construct a Type::Matrix4 variant with the given value.
|
inline |
Construct a Type::Pointer variant with the given value.
Definition at line 332 of file UT_Variant.h.
| UT_Variant::UT_Variant | ( | const UT_VariantArray & | v | ) |
Construct a Type::Array variant with the given value.
| UT_Variant::UT_Variant | ( | UT_VariantArray && | v | ) |
Construct a Type::Array variant with the given value.
| UT_Variant::UT_Variant | ( | const UT_VariantMap & | v | ) |
Construct a Type::Map variant with the given value.
| UT_Variant::UT_Variant | ( | UT_VariantMap && | v | ) |
Construct a Type::Map variant with the given value.
| UT_Variant::UT_Variant | ( | const UT_Variant & | v | ) |
Copy construct a variant with the given value.
| UT_Variant::UT_Variant | ( | UT_Variant && | v | ) |
Move construct a variant with the given value.
| UT_Variant::~UT_Variant | ( | ) |
Variant destructor. For shared items, it only decreases reference counts.
| bool UT_Variant::convert | ( | Type | type | ) |
Convert this variant to a different type, in-place. Returns true if the conversion succeeded. If the conversion failed, the variant is left as-is.
| std::enable_if< UT_Variant::IsTrivialType< T >::value &&!UT_Variant::IsConvertibleType< T >::value, T >::type UT_Variant::get | ( | bool & | ok | ) | const |
Return the type requested by the template argument. If the contained type is not of the requested type, a conversion is attempted. If the conversion fails, the default instance of the return type is returned and the value of ok is set to false. Compound values, such as the vector and matrix types are returned by reference, whereas all the others are returned by value.
Definition at line 750 of file UT_Variant.h.
| std::enable_if< UT_Variant::IsCompoundType< T >::value &&!UT_Variant::IsConvertibleType< T >::value, const T & >::type UT_Variant::get | ( | bool & | ok | ) | const |
Return the type requested by the template argument. If the contained type is not of the requested type, a conversion is attempted. If the conversion fails, the default instance of the return type is returned and the value of ok is set to false. Compound values, such as the vector and matrix types are returned by reference, whereas all the others are returned by value.
Definition at line 758 of file UT_Variant.h.
| std::enable_if<!UT_Variant::IsTrivialType< T >::value &&!UT_Variant::IsCompoundType< T >::value &&UT_Variant::IsConvertibleType< T >::value, T >::type UT_Variant::get | ( | bool & | ok | ) | const |
Return the type requested by the template argument. If the contained type is not of the requested type, a conversion is attempted. If the conversion fails, the default instance of the return type is returned and the value of ok is set to false. Compound values, such as the vector and matrix types are returned by reference, whereas all the others are returned by value.
Definition at line 791 of file UT_Variant.h.
|
inline |
Return the type requested by the template argument. If the contained type is not of the requested type, a conversion is attempted. If the conversion fails, a default value is returned for the type requested.
Definition at line 411 of file UT_Variant.h.
|
inline |
Return the type requested by the template argument. If the contained type is not of the requested type, a conversion is attempted. If the conversion fails, a default value is returned for the type requested.
Definition at line 416 of file UT_Variant.h.
|
inline |
Return the type requested by the template argument. If the contained type is not of the requested type, a conversion is attempted. If the conversion fails, a default value is returned for the type requested.
Definition at line 422 of file UT_Variant.h.
| UT_Variant& UT_Variant::operator= | ( | const UT_Variant & | v | ) |
Copy assignment operator. For shared data, it only adds a reference to them.
| UT_Variant& UT_Variant::operator= | ( | UT_Variant && | v | ) |
Move assignment operator. The passed-in variant is cleared out and left as an unknown type.
| bool UT_Variant::operator== | ( | const UT_Variant & | v | ) | const |
Set the value and type of this variant to match the type and value of the argument passed in.
Definition at line 427 of file UT_Variant.h.
|
inline |
An explicit method of setting the variant type to null.
Definition at line 377 of file UT_Variant.h.
|
inline |
Definition at line 367 of file UT_Variant.h.
|
inline |
Definition at line 368 of file UT_Variant.h.
|
static |
| bool UT_Variant::m_bool |
Definition at line 460 of file UT_Variant.h.
| fpreal64 UT_Variant::m_float |
Definition at line 462 of file UT_Variant.h.
| int64 UT_Variant::m_int |
Definition at line 461 of file UT_Variant.h.
| void* UT_Variant::m_ptr |
Definition at line 463 of file UT_Variant.h.
| std::array<unsigned char, 24> UT_Variant::m_storage |
Definition at line 469 of file UT_Variant.h.