xentara-workbench-plugin v1.3
The Xentara Workbench Plugin Framework
Loading...
Searching...
No Matches
xentara::workbench::bindings::ValueOrUndefined< Value > Class Template Referencefinal

A value that keeps track of whether is was ever assigned to. More...

#include <xentara/workbench/bindings/ValueOrUndefined.hpp>

Public Types

using ValueView = __const_reference_or_basic_string_view__
 A type representing a view of the value.
 

Public Member Functions

 ValueOrUndefined ()=default
 Default constructor.
 
 ValueOrUndefined (const ValueOrUndefined &)=default
 Copy constructor.
 
 ValueOrUndefined (ValueOrUndefined &&)=default
 Move constructor.
 
template<typename RelatedValue >
constexpr ValueOrUndefined (const ValueOrUndefined< RelatedValue > &other)
 Copy constructor for related values.
 
template<typename RelatedValue >
constexpr ValueOrUndefined (ValueOrUndefined< RelatedValue > &&other)
 Move constructor for related values.
 
constexpr ValueOrUndefined (Value &&value)
 Default constructor.
 
constexpr ValueOrUndefined (const Value &value)
 Default constructor.
 
template<class... Arguments>
constexpr ValueOrUndefined (std::in_place_t, Arguments &&...arguments)
 Move that initializes the value.
 
template<class InitValue , class... Arguments>
constexpr ValueOrUndefined (std::in_place_t, std::initializer_list< InitValue > initializerList, Arguments &&...arguments)
 Move that initializes the value.
 
template<typename UndefinedValue >
constexpr ValueOrUndefined (const Undefined< UndefinedValue > &undefined) noexcept(std::is_nothrow_constructible_v< Value, const UndefinedValue & >)
 Copy constructor for undefined values.
 
template<typename UndefinedValue >
constexpr ValueOrUndefined (Undefined< UndefinedValue > &&undefined) noexcept(std::is_nothrow_constructible_v< Value, UndefinedValue && >)
 Move constructor for undefined values.
 
auto operator= (const ValueOrUndefined &) -> ValueOrUndefined &=default
 Copy constructor.
 
auto operator= (ValueOrUndefined &&) -> ValueOrUndefined &=default
 Move constructor.
 
template<typename RelatedValue >
constexpr auto operator= (const ValueOrUndefined< RelatedValue > &rhs) -> ValueOrUndefined &
 Copy constructor for related values.
 
template<typename RelatedValue >
constexpr auto operator= (ValueOrUndefined< RelatedValue > &&rhs) noexcept(std::is_nothrow_assignable_v< Value &, RelatedValue && >) -> ValueOrUndefined &
 Move constructor for related values.
 
constexpr auto operator= (const Value &value) noexcept(std::is_nothrow_assignable_v< Value &, const Value & >) -> ValueOrUndefined &
 Default constructor.
 
constexpr auto operator= (Value &&value) noexcept(std::is_nothrow_assignable_v< Value &, Value && >) -> ValueOrUndefined &
 Assignment operator.
 
template<class UndefinedValue >
constexpr auto operator= (const Undefined< UndefinedValue > &undefined)
 
template<class UndefinedValue >
constexpr auto operator= (Undefined< UndefinedValue > &&undefined)
 
constexpr operator ValueView () const noexcept
 Conversion to a value view.
 
constexpr auto hasValue () const noexcept -> bool
 Checks whether the object contains a value.
 
constexpr auto value () const &noexcept -> const Value &
 Gets the value.
 
constexpr auto value () &noexcept -> Value &
 Gets the value.
 
constexpr auto value () const &&noexcept -> const Value &&
 Gets the value.
 
constexpr auto value () &&noexcept -> Value &&
 Gets the value.
 
constexpr auto swap (ValueOrUndefined &other) noexcept(std::is_nothrow_swappable_v< Value >) -> void
 Swaps two undefined values.
 

Detailed Description

template<typename Value>
class xentara::workbench::bindings::ValueOrUndefined< Value >

A value that keeps track of whether is was ever assigned to.

This type can be used to store properties that can have an “undefined” state. This can be used to keep track of whether the property was ever set, allowing you to consider default values an error. This is useful for things like device IDs or PLC data block IDs that cannot have a useful default value.

Note that an undefined value still has a value associated with it. This value should reflect a useful default, giving the user a hint of what the value could be.

ValueOrUndefined values can be bound to bindings in the same way as the base value. For example, a variable of type ValueOrUndefined<std::string> can be bound to a binding of type TextField.

Member Typedef Documentation

◆ ValueView

template<typename Value >
using xentara::workbench::bindings::ValueOrUndefined< Value >::ValueView = __const_reference_or_basic_string_view__

A type representing a view of the value.

This is normally a const reference to the value, except for instatiations of std::basic_string, where the view is an std::basic_string_view with the same character type and traits.

Constructor & Destructor Documentation

◆ ValueOrUndefined() [1/11]

template<typename Value >
xentara::workbench::bindings::ValueOrUndefined< Value >::ValueOrUndefined ( )
default

Default constructor.

◆ ValueOrUndefined() [2/11]

template<typename Value >
xentara::workbench::bindings::ValueOrUndefined< Value >::ValueOrUndefined ( const ValueOrUndefined< Value > &  )
default

Copy constructor.

◆ ValueOrUndefined() [3/11]

template<typename Value >
xentara::workbench::bindings::ValueOrUndefined< Value >::ValueOrUndefined ( ValueOrUndefined< Value > &&  )
default

Move constructor.

◆ ValueOrUndefined() [4/11]

template<typename Value >
template<typename RelatedValue >
constexpr xentara::workbench::bindings::ValueOrUndefined< Value >::ValueOrUndefined ( const ValueOrUndefined< RelatedValue > &  other)
constexpr

Copy constructor for related values.

◆ ValueOrUndefined() [5/11]

template<typename Value >
template<typename RelatedValue >
constexpr xentara::workbench::bindings::ValueOrUndefined< Value >::ValueOrUndefined ( ValueOrUndefined< RelatedValue > &&  other)
constexpr

Move constructor for related values.

◆ ValueOrUndefined() [6/11]

template<typename Value >
constexpr xentara::workbench::bindings::ValueOrUndefined< Value >::ValueOrUndefined ( Value &&  value)
constexpr

Default constructor.

◆ ValueOrUndefined() [7/11]

template<typename Value >
constexpr xentara::workbench::bindings::ValueOrUndefined< Value >::ValueOrUndefined ( const Value &  value)
constexpr

Default constructor.

◆ ValueOrUndefined() [8/11]

template<typename Value >
template<class... Arguments>
constexpr xentara::workbench::bindings::ValueOrUndefined< Value >::ValueOrUndefined ( std::in_place_t  ,
Arguments &&...  arguments 
)
constexpr

Move that initializes the value.

◆ ValueOrUndefined() [9/11]

template<typename Value >
template<class InitValue , class... Arguments>
constexpr xentara::workbench::bindings::ValueOrUndefined< Value >::ValueOrUndefined ( std::in_place_t  ,
std::initializer_list< InitValue >  initializerList,
Arguments &&...  arguments 
)
constexpr

Move that initializes the value.

◆ ValueOrUndefined() [10/11]

template<typename Value >
template<typename UndefinedValue >
constexpr xentara::workbench::bindings::ValueOrUndefined< Value >::ValueOrUndefined ( const Undefined< UndefinedValue > &  undefined)
constexprnoexcept

Copy constructor for undefined values.

◆ ValueOrUndefined() [11/11]

template<typename Value >
template<typename UndefinedValue >
constexpr xentara::workbench::bindings::ValueOrUndefined< Value >::ValueOrUndefined ( Undefined< UndefinedValue > &&  undefined)
constexprnoexcept

Move constructor for undefined values.

Member Function Documentation

◆ hasValue()

template<typename Value >
constexpr auto xentara::workbench::bindings::ValueOrUndefined< Value >::hasValue ( ) const -> bool
constexprnoexcept

Checks whether the object contains a value.

◆ operator ValueView()

template<typename Value >
constexpr xentara::workbench::bindings::ValueOrUndefined< Value >::operator ValueView ( ) const
constexprnoexcept

Conversion to a value view.

◆ operator=() [1/8]

template<typename Value >
template<class UndefinedValue >
constexpr auto xentara::workbench::bindings::ValueOrUndefined< Value >::operator= ( const Undefined< UndefinedValue > &  undefined)
constexpr

◆ operator=() [2/8]

template<typename Value >
constexpr auto xentara::workbench::bindings::ValueOrUndefined< Value >::operator= ( const Value &  value) -> ValueOrUndefined &
constexprnoexcept

Default constructor.

◆ operator=() [3/8]

template<typename Value >
auto xentara::workbench::bindings::ValueOrUndefined< Value >::operator= ( const ValueOrUndefined< Value > &  ) -> ValueOrUndefined &=default
default

Copy constructor.

◆ operator=() [4/8]

template<typename Value >
template<typename RelatedValue >
constexpr auto xentara::workbench::bindings::ValueOrUndefined< Value >::operator= ( const ValueOrUndefined< RelatedValue > &  rhs) -> ValueOrUndefined &
constexpr

Copy constructor for related values.

◆ operator=() [5/8]

template<typename Value >
template<class UndefinedValue >
constexpr auto xentara::workbench::bindings::ValueOrUndefined< Value >::operator= ( Undefined< UndefinedValue > &&  undefined)
constexpr

◆ operator=() [6/8]

template<typename Value >
constexpr auto xentara::workbench::bindings::ValueOrUndefined< Value >::operator= ( Value &&  value) -> ValueOrUndefined &
constexprnoexcept

Assignment operator.

◆ operator=() [7/8]

template<typename Value >
auto xentara::workbench::bindings::ValueOrUndefined< Value >::operator= ( ValueOrUndefined< Value > &&  ) -> ValueOrUndefined &=default
default

Move constructor.

◆ operator=() [8/8]

template<typename Value >
template<typename RelatedValue >
constexpr auto xentara::workbench::bindings::ValueOrUndefined< Value >::operator= ( ValueOrUndefined< RelatedValue > &&  rhs) -> ValueOrUndefined &
constexprnoexcept

Move constructor for related values.

◆ swap()

template<typename Value >
constexpr auto xentara::workbench::bindings::ValueOrUndefined< Value >::swap ( ValueOrUndefined< Value > &  other) -> void
constexprnoexcept

Swaps two undefined values.

◆ value() [1/4]

template<typename Value >
constexpr auto xentara::workbench::bindings::ValueOrUndefined< Value >::value ( ) && -> Value &&
constexprnoexcept

Gets the value.

◆ value() [2/4]

template<typename Value >
constexpr auto xentara::workbench::bindings::ValueOrUndefined< Value >::value ( ) & -> Value &
constexprnoexcept

Gets the value.

◆ value() [3/4]

template<typename Value >
constexpr auto xentara::workbench::bindings::ValueOrUndefined< Value >::value ( ) const && -> const Value &&
constexprnoexcept

Gets the value.

◆ value() [4/4]

template<typename Value >
constexpr auto xentara::workbench::bindings::ValueOrUndefined< Value >::value ( ) const & -> const Value &
constexprnoexcept

Gets the value.