ufe  4.2
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
 Move constructor. More...
 
Valueoperator= (const Value &v)
 Default assignment operator. More...
 
Valueoperator= (Value &&) noexcept
 Move assignment. Right hand side becomes empty. More...
 
 ~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
 Equality operators. More...
 
bool operator!= (const Value &rhs) const
 Equality operators. More...
 

Private Attributes

std::unique_ptr< Imp > _imp
 

Detailed Description

Value class that can hold a wide set of types.

This class is instantiated for the following types:

  • bool
  • int
  • float
  • double
  • string

Definition at line 34 of file value.h.

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.

◆ ~Value()

Ufe::Value::~Value ( )

Destructor.

Member Function Documentation

◆ empty()

bool Ufe::Value::empty ( ) const
Returns
True iff this value is empty.

◆ get()

template<typename T >
T Ufe::Value::get ( ) const
Returns
The current value if template type matches actual type.
Exceptions
InvalidValueGetIf the template type doesn't match the type of the actual value.

◆ 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. Right hand side becomes empty.

◆ 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 type name of the contained value if non-empty, otherwise empty string.

Member Data Documentation

◆ _imp

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

Definition at line 87 of file value.h.


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