le2d v0.4.7
2D game engine framework
 
Loading...
Searching...
No Matches
le::Tweakable< Type > Class Template Reference

Tweakable wrapper over a Type value. More...

#include <le2d/tweak/tweakable.hpp>

Inheritance diagram for le::Tweakable< Type >:
le::ITweakable

Public Types

using Parser = tweak::Parser< Type >
 
using Callback = tweak::Callback< Type >
 Setter hook callback.
 

Public Member Functions

 explicit (false) Tweakable()
 
template<std::convertible_to< Type > T>
 explicit (false) Tweakable(T t)
 
auto operator= (Type t) -> Tweakable &
 
auto type_name () const -> std::string_view final
 
auto as_string () const -> std::string_view final
 
auto assign (std::string_view const input) -> bool final
 Parse input into value and assign if successful.
 
auto get_value () const -> Type const &
 
auto get_value () -> Type &
 
auto set_value (Type value) -> bool
 Set value and invoke OnChange (if not null).
 
void on_set (Callback callback)
 Install setter hook callback.
 
 explicit (std::same_as< bool, Type >) operator Type const &() const
 

Detailed Description

template<typename Type>
class le::Tweakable< Type >

Tweakable wrapper over a Type value.

Member Typedef Documentation

◆ Callback

template<typename Type >
using le::Tweakable< Type >::Callback = tweak::Callback<Type>

Setter hook callback.

◆ Parser

template<typename Type >
using le::Tweakable< Type >::Parser = tweak::Parser<Type>

Member Function Documentation

◆ as_string()

template<typename Type >
auto le::Tweakable< Type >::as_string ( ) const -> std::string_view
inlinefinalvirtual

Implements le::ITweakable.

◆ assign()

template<typename Type >
auto le::Tweakable< Type >::assign ( std::string_view const  input) -> bool
inlinefinalvirtual

Parse input into value and assign if successful.

Parameters
inputInput to parse.
Returns
true if successfully parsed.

Implements le::ITweakable.

◆ explicit() [1/3]

template<typename Type >
le::Tweakable< Type >::explicit ( false  )
inline

◆ explicit() [2/3]

template<typename Type >
template<std::convertible_to< Type > T>
le::Tweakable< Type >::explicit ( false  )
inline

◆ explicit() [3/3]

template<typename Type >
le::Tweakable< Type >::explicit ( std::same_as< bool, Type >  ) const &
inline

◆ get_value() [1/2]

template<typename Type >
auto le::Tweakable< Type >::get_value ( ) -> Type&
inline

◆ get_value() [2/2]

template<typename Type >
auto le::Tweakable< Type >::get_value ( ) const -> Type const&
inline

◆ on_set()

template<typename Type >
void le::Tweakable< Type >::on_set ( Callback  callback)
inline

Install setter hook callback.

◆ operator=()

template<typename Type >
auto le::Tweakable< Type >::operator= ( Type  t) -> Tweakable&
inline

◆ set_value()

template<typename Type >
auto le::Tweakable< Type >::set_value ( Type  value) -> bool
inline

Set value and invoke OnChange (if not null).

Parameters
valueValue to set.

◆ type_name()

template<typename Type >
auto le::Tweakable< Type >::type_name ( ) const -> std::string_view
inlinefinalvirtual

Implements le::ITweakable.


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