KDDockWidgets API Documentation 2.1
Loading...
Searching...
No Matches
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>

Inheritance diagram for KDBindings::Binding< T, EvaluatorT >:
Inheritance graph
[legend]
Collaboration diagram for KDBindings::Binding< T, EvaluatorT >:
Collaboration graph
[legend]

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.
 
 ~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
 
- Public Member Functions inherited from KDBindings::Private::Dirtyable
 Dirtyable ()=default
 
virtual ~Dirtyable ()=default
 
bool isDirty () const
 
virtual void markDirty ()
 
void setParent (Dirtyable *newParent)
 

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, KDBindings::Binding< T, EvaluatorT >::m_rootNode, and KDBindings::Private::Node< ResultType >::setParent().

◆ ~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
inlineoverrideprotectedvirtual

Implements KDBindings::Private::Dirtyable.

Definition at line 98 of file binding.h.

◆ evaluate()

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

◆ get()

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

◆ 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 ( )
inlineoverrideprotectedvirtual

Implements KDBindings::Private::Dirtyable.

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/
KDDockWidgets
Advanced Dock Widget Framework for Qt
https://www.kdab.com/development-resources/qt-tools/kddockwidgets/
Generated by doxygen 1.9.8