ufe 7.0
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
Ufe::Value Class Reference

Value class that can hold a wide set of types. More...

#include <value.h>

Public Member Functions

 Value ()
 Default constructor. Creates an empty Value. More...
 
template<typename T >
 Value (const T &v)
 
 Value (const Value &)
 Default copy constructor. More...
 
 Value (Value &&) noexcept
 
Valueoperator= (const Value &v)
 Default assignment operator. More...
 
Valueoperator= (Value &&) noexcept
 
 ~Value ()
 Destructor. More...
 
template<typename T >
get () const
 
template<typename T >
safeGet (T arg) const
 
bool empty () const
 
std::string typeName () const
 
template<typename T >
bool isType () const
 
bool operator== (const Value &rhs) const
 
bool operator!= (const Value &rhs) const
 

Private Attributes

std::unique_ptr< Imp > _imp
 

Detailed Description

Constructor & Destructor Documentation

◆ Value() [1/4]

Ufe::Value::Value ( )

Default constructor. Creates an empty Value.

◆ Value() [2/4]

template<typename T >
Ufe::Value::Value ( const T &  v)

Create a Value from the argument.

Parameters
vValue.

◆ Value() [3/4]

Ufe::Value::Value ( const Value )

Default copy constructor.

◆ Value() [4/4]

Ufe::Value::Value ( Value &&  )
noexcept

Move constructor.

Note
Right hand side becomes invalid object and can no longer be used.

◆ ~Value()

Ufe::Value::~Value ( )

Destructor.

Member Function Documentation

◆ empty()

bool Ufe::Value::empty ( ) const
Returns
True iff this value is empty.
Note
An empty Value has no type and no contained value.
A Value created with the default constructor is empty.
A Value created with a type constructor is non-empty (has a type and a value). This inclues types like std::string which can contain an empty string, but the Value will be non-empty.

◆ get()

template<typename T >
T Ufe::Value::get ( ) const
Returns
The current value if template type matches actual type.
Note
Asking for std::string will always succeed by converting the actual value to string. This is useful for logging and debugging. The returned string is not formatted in any human readable way, it is just a direct conversion of the actual value.
Exceptions
InvalidValueGetIf the template type doesn't match the type of the actual value unless the requested type is std::string which is supported for all storage types.

◆ isType()

template<typename T >
bool Ufe::Value::isType ( ) const
Returns
True if the contained value is an object of type T.

◆ operator!=()

bool Ufe::Value::operator!= ( const Value rhs) const

Equality operators.

◆ operator=() [1/2]

Value & Ufe::Value::operator= ( const Value v)

Default assignment operator.

◆ operator=() [2/2]

Value & Ufe::Value::operator= ( Value &&  )
noexcept

Move assignment.

Note
Right hand side becomes invalid object and can no longer be used.

◆ operator==()

bool Ufe::Value::operator== ( const Value rhs) const

Equality operators.

◆ safeGet()

template<typename T >
T Ufe::Value::safeGet ( arg) const

Returns a copy of the value if the template type matches actual type. Returns the input argument value otherwise. Especially useful to return a default when dealing with an empty Ufe::Value.

Returns
The current value if template type matches actual type, otherwise arg.

◆ typeName()

std::string Ufe::Value::typeName ( ) const

Returns the C++ type name of the contained value if non-empty. For basic types matches the typeid(T) function. For complex types will return more human readable string for easier comparison.

Returns
Empty string if Value is empty.
"bool", "int", "unsigned int", "float", "double" for basic types.
"std::string" for std::string type.
"Ufe::Vector2i" for Ufe::Vector2i type.
"Ufe::Vector2f" for Ufe::Vector2f type.
"Ufe::Vector2d" for Ufe::Vector2d type.
"Ufe::Vector3i" for Ufe::Vector3i type.
"Ufe::Vector3f" for Ufe::Vector3f type.
"Ufe::Vector3d" for Ufe::Vector3d type.
"Ufe::Vector4i" for Ufe::Vector4i type.
"Ufe::Vector4f" for Ufe::Vector4f type.
"Ufe::Vector4d" for Ufe::Vector4d type.
"Ufe::Color3f" for Ufe::Color3f type.
"Ufe::Color4f" for Ufe::Color4f type.
"Ufe::Matrix3d" for Ufe::Matrix3d type.
"Ufe::Matrix4d" for Ufe::Matrix4d type.
"Ufe::BoolArray" for Ufe::BoolArray type.
"Ufe::IntArray" for Ufe::IntArray type.
"Ufe::UIntArray" for Ufe::UIntArray type.
"Ufe::FloatArray" for Ufe::FloatArray type.
"Ufe::DoubleArray" for Ufe::DoubleArray type.
"Ufe::StringArray" for Ufe::StringArray type.
"Ufe::Vector2iArray" for Ufe::Vector2iArray type.
"Ufe::Vector2fArray" for Ufe::Vector2fArray type.
"Ufe::Vector2dArray" for Ufe::Vector2dArray type.
"Ufe::Vector3iArray" for Ufe::Vector3iArray type.
"Ufe::Vector3fArray" for Ufe::Vector3fArray type.
"Ufe::Vector3dArray" for Ufe::Vector3dArray type.
"Ufe::Vector4iArray" for Ufe::Vector4iArray type.
"Ufe::Vector4fArray" for Ufe::Vector4fArray type.
"Ufe::Vector4dArray" for Ufe::Vector4dArray type.
"Ufe::Color3fArray" for Ufe::Color3fArray type.
"Ufe::Color4fArray" for Ufe::Color4fArray type.
"Ufe::Matrix3dArray" for Ufe::Matrix3dArray type.
"Ufe::Matrix4dArray" for Ufe::Matrix4dArray type.

Member Data Documentation

◆ _imp

std::unique_ptr<Imp> Ufe::Value::_imp
private

Definition at line 170 of file value.h.


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