KDBindings API Documentation  1.0.95
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
KDBindings::Binding< T, EvaluatorT > Class Template Reference

A combination of a root Node with an evaluator. More...

#include <binding.h>

Public Member Functions

 Binding ()=delete
 
 Binding (Binding &&other)=delete
 
 Binding (Binding const &other)=delete
 
 Binding (Private::Node< T > &&rootNode, EvaluatorT const &evaluator)
 Construct a new Binding with a specific evaluator. More...
 
 ~Binding () override
 
void evaluate ()
 
get () const override
 
Bindingoperator= (Binding &&other)=delete
 
Bindingoperator= (Binding const &other)=delete
 
void setUpdateFunction (std::function< void(T &&)> const &updateFunction) override
 
- Public Member Functions inherited from KDBindings::PropertyUpdater< T >
 PropertyUpdater ()=default
 
 PropertyUpdater (PropertyUpdater &&other)=default
 
 PropertyUpdater (PropertyUpdater const &other)=default
 
virtual ~PropertyUpdater ()=default
 
PropertyUpdateroperator= (PropertyUpdater &&other)=default
 
PropertyUpdateroperator= (PropertyUpdater const &other)=default
 

Protected Member Functions

const bool * dirtyVariable () const override
 
Private::Dirtyable ** parentVariable () override
 

Protected Attributes

int m_bindingId = -1
 
EvaluatorT m_evaluator
 
std::function< void(T &&)> m_propertyUpdateFunction = [](T &&) {}
 
Private::Node< T > m_rootNode
 

Detailed Description

template<typename T, typename EvaluatorT = BindingEvaluator>
class KDBindings::Binding< T, EvaluatorT >

A combination of a root Node with an evaluator.

A root Node is formed whenever multiple properties are combined inside a expression and an evaluator is responsible for re-evaluating such an expression whenever any of the constituent properties change.

Template Parameters
TThe type of the value that the Binding expression evaluates to.
EvaluatorTThe type of the evaluator that is used to evaluate the Binding.

Definition at line 34 of file binding.h.

Constructor & Destructor Documentation

◆ Binding() [1/4]

template<typename T , typename EvaluatorT = BindingEvaluator>
KDBindings::Binding< T, EvaluatorT >::Binding ( Private::Node< T > &&  rootNode,
EvaluatorT const &  evaluator 
)
inlineexplicit

Construct a new Binding with a specific evaluator.

Parameters
rootNodeRepresents that expression contained in the Binding.
evaluatorUsed to evaluate the expression contained in the Binding.

Definition at line 47 of file binding.h.

References KDBindings::Binding< T, EvaluatorT >::m_bindingId, KDBindings::Binding< T, EvaluatorT >::m_evaluator, and KDBindings::Binding< T, EvaluatorT >::m_rootNode.

◆ ~Binding()

template<typename T , typename EvaluatorT = BindingEvaluator>
KDBindings::Binding< T, EvaluatorT >::~Binding ( )
inlineoverride

Destructs the Binding by deregistering it from its evaluator.

Definition at line 56 of file binding.h.

References KDBindings::Binding< T, EvaluatorT >::m_bindingId, and KDBindings::Binding< T, EvaluatorT >::m_evaluator.

◆ Binding() [2/4]

template<typename T , typename EvaluatorT = BindingEvaluator>
KDBindings::Binding< T, EvaluatorT >::Binding ( )
delete

A Binding is not default constructible.

◆ Binding() [3/4]

template<typename T , typename EvaluatorT = BindingEvaluator>
KDBindings::Binding< T, EvaluatorT >::Binding ( Binding< T, EvaluatorT > const &  other)
delete

A Binding cannot be copy constructed.

◆ Binding() [4/4]

template<typename T , typename EvaluatorT = BindingEvaluator>
KDBindings::Binding< T, EvaluatorT >::Binding ( Binding< T, EvaluatorT > &&  other)
delete

A Binding can not be move constructed.

Member Function Documentation

◆ dirtyVariable()

template<typename T , typename EvaluatorT = BindingEvaluator>
const bool* KDBindings::Binding< T, EvaluatorT >::dirtyVariable ( ) const
inlineoverrideprotected

Definition at line 98 of file binding.h.

◆ evaluate()

template<typename T , typename EvaluatorT = BindingEvaluator>
void KDBindings::Binding< T, EvaluatorT >::evaluate ( )
inline

Re-evaluates the value of the Binding and notifies all dependants of the change.

Definition at line 88 of file binding.h.

References KDBindings::Binding< T, EvaluatorT >::m_propertyUpdateFunction, and KDBindings::Binding< T, EvaluatorT >::m_rootNode.

Referenced by KDBindings::Binding< T, ImmediateBindingEvaluator >::markDirty().

◆ get()

template<typename T , typename EvaluatorT = BindingEvaluator>
T KDBindings::Binding< T, EvaluatorT >::get ( ) const
inlineoverridevirtual

Returns the current value of the Binding.

Implements KDBindings::PropertyUpdater< T >.

Definition at line 85 of file binding.h.

References KDBindings::Binding< T, EvaluatorT >::m_rootNode.

◆ operator=() [1/2]

template<typename T , typename EvaluatorT = BindingEvaluator>
Binding& KDBindings::Binding< T, EvaluatorT >::operator= ( Binding< T, EvaluatorT > &&  other)
delete

A Binding can not be move assigned.

◆ operator=() [2/2]

template<typename T , typename EvaluatorT = BindingEvaluator>
Binding& KDBindings::Binding< T, EvaluatorT >::operator= ( Binding< T, EvaluatorT > const &  other)
delete

A Binding cannot be copy assigned.

◆ parentVariable()

template<typename T , typename EvaluatorT = BindingEvaluator>
Private::Dirtyable** KDBindings::Binding< T, EvaluatorT >::parentVariable ( )
inlineoverrideprotected

Definition at line 97 of file binding.h.

◆ setUpdateFunction()

template<typename T , typename EvaluatorT = BindingEvaluator>
void KDBindings::Binding< T, EvaluatorT >::setUpdateFunction ( std::function< void(T &&)> const &  updateFunction)
inlineoverridevirtual

Set the function that should be used to notify associated properties when the Binding re-evaluates.

Implements KDBindings::PropertyUpdater< T >.

Definition at line 79 of file binding.h.

References KDBindings::Binding< T, EvaluatorT >::m_propertyUpdateFunction.

Member Data Documentation

◆ m_bindingId

template<typename T , typename EvaluatorT = BindingEvaluator>
int KDBindings::Binding< T, EvaluatorT >::m_bindingId = -1
protected

The id of the Binding, used for keeping track of the Binding in its evaluator.

Definition at line 107 of file binding.h.

Referenced by KDBindings::Binding< T, EvaluatorT >::Binding(), and KDBindings::Binding< T, EvaluatorT >::~Binding().

◆ m_evaluator

template<typename T , typename EvaluatorT = BindingEvaluator>
EvaluatorT KDBindings::Binding< T, EvaluatorT >::m_evaluator
protected

The evaluator responsible for evaluating this Binding.

Definition at line 103 of file binding.h.

Referenced by KDBindings::Binding< T, EvaluatorT >::Binding(), and KDBindings::Binding< T, EvaluatorT >::~Binding().

◆ m_propertyUpdateFunction

template<typename T , typename EvaluatorT = BindingEvaluator>
std::function<void(T &&)> KDBindings::Binding< T, EvaluatorT >::m_propertyUpdateFunction = [](T &&) {}
protected

The function used to notify associated properties when the Binding re-evaluates

Definition at line 105 of file binding.h.

Referenced by KDBindings::Binding< T, EvaluatorT >::evaluate(), and KDBindings::Binding< T, EvaluatorT >::setUpdateFunction().

◆ m_rootNode

template<typename T , typename EvaluatorT = BindingEvaluator>
Private::Node<T> KDBindings::Binding< T, EvaluatorT >::m_rootNode
protected

The root Node of the Binding represents the expression contained by the Binding.

Definition at line 101 of file binding.h.

Referenced by KDBindings::Binding< T, EvaluatorT >::Binding(), KDBindings::Binding< T, EvaluatorT >::evaluate(), and KDBindings::Binding< T, EvaluatorT >::get().


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

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDBindings
Reactive programming & data binding in C++
https://github.com/KDAB/KDBindings/
Generated by doxygen 1.9.1