Base class for binding runtimes. More...
#include <kanzi/core.ui/binding/abstract_binding_runtime.hpp>
Public Types | |
enum | AttachmentState { Detached, Detaching, Attaching, Attached, Removed } |
Attachment state for keeping track current status. More... | |
Public Member Functions | |
void | attach () |
Attach the binding. More... | |
void | detach () |
Detaches the binding. More... | |
void | detachIfAttachedOrAttaching () |
Detaches the binding if it is attaching or attached. More... | |
AbstractBindingSharedPtr | getBinding () const |
Returns the binding associated with this binding runtime. More... | |
shared_ptr< void > | getOwner () const |
Gets the owner. More... | |
BindingSourceRuntime * | getSourceRuntime () const |
Gets the source runtime. More... | |
BindingTargetRuntime * | getTargetRuntime () const |
Gets the target runtime. More... | |
bool | isAttached () const |
Indicates whether this binding runtime has been attached. More... | |
bool | isAttaching () const |
Indicates whether this binding runtime is being attached. More... | |
bool | isConnected () |
Indicates whether this binding runtime is connected. More... | |
bool | isDetached () const |
Indicates whether this binding runtime is detached. More... | |
bool | isDetaching () const |
Indicates whether this binding runtime is being detached. More... | |
bool | isRemoved () const |
Gets whether the binding runtime has been removed from the binding host. More... | |
void | notifySourceChanged () |
Called when binding source has changed. More... | |
void | notifyTargetChanged () |
Called when binding target has changed. More... | |
void | onRemoved () |
Called when binding is being removed from where it has been installed. More... | |
void | removeFromHost () |
Removes the binding runtime from the binding host. More... | |
void | setHost (BindingHostConceptSharedPtr hostObject) |
Sets the binding host object in which the binding runtime is hosted. More... | |
void | setOwner (shared_ptr< void > owner) |
Set the owner. More... | |
bool | update () |
Execute the binding. More... | |
virtual | ~AbstractBindingRuntime () |
Destructor. More... | |
Protected Member Functions | |
AbstractBindingRuntime (AbstractBindingSharedPtr binding, BindingSourceRuntimePtr sourceRuntime, BindingTargetRuntimePtr targetRuntime) | |
Constructor. More... | |
virtual void | attachOverride ()=0 |
Binding-dependent attach. More... | |
virtual void | detachOverride ()=0 |
Binding-dependent detach. More... | |
virtual bool | isConnectedOverride () |
Binding-dependent attached indication. More... | |
virtual void | notifySourceChangedOverride () |
Binding-dependent source change. More... | |
virtual void | notifyTargetChangedOverride () |
Binding-dependent target change. More... | |
bool | readFromSource (Variant &value) |
Read from source and execute forward validators. More... | |
bool | readFromTarget (Variant &value) |
Reads from target and executes reverse validators. More... | |
virtual bool | updateOverride ()=0 |
Binding-dependent update. More... | |
bool | writeToSource (const Variant &value) const |
Writes to source. More... | |
bool | writeToTarget (const Variant &value) |
Write to target. More... | |
Protected Attributes | |
AttachmentState | m_attachmentState |
Current binding runtime state. More... | |
AbstractBindingSharedPtr | m_binding |
Associated binding. More... | |
BindingHostConceptWeakPtr | m_bindingHost |
The binding host object in which the binding runtime is hosted. More... | |
weak_ptr< void > | m_owner |
Owner for tagging the runtime. More... | |
BindingSourceRuntimePtr | m_sourceRuntime |
Runtime for source. More... | |
BindingTargetRuntimePtr | m_targetRuntime |
Runtime for target. More... | |
Base class for binding runtimes.
Bindings create abstract binding runtimes to serve as the runtime data of the bindings. Binding runtimes refer to their source bindings, but do not alter them.
Distinct binding implementations create objects of classes inheriting the base AbstractBindingRuntime.
When you remove a binding runtime from a binding host, Kanzi detaches the binding and makes the binding runtime unusable.
|
virtual |
Destructor.
|
explicitprotected |
Constructor.
Abstract binding runtime takes ownership of both source and target runtimes.
binding | Host binding to keep a reference to. |
sourceRuntime | Source runtime. |
targetRuntime | Target runtime. |
void kanzi::AbstractBindingRuntime::attach | ( | ) |
Attach the binding.
Attaches source and target.
void kanzi::AbstractBindingRuntime::detach | ( | ) |
Detaches the binding.
Detaches all sources and target
void kanzi::AbstractBindingRuntime::detachIfAttachedOrAttaching | ( | ) |
Detaches the binding if it is attaching or attached.
void kanzi::AbstractBindingRuntime::onRemoved | ( | ) |
Called when binding is being removed from where it has been installed.
Automatically called on binding target runtime destruction, but also called manually when binding is being removed from a Node or RenderPass to remove potential installed value sources.
void kanzi::AbstractBindingRuntime::notifySourceChanged | ( | ) |
Called when binding source has changed.
Usually called by binding sources that notify the binding runtime of the change.
void kanzi::AbstractBindingRuntime::notifyTargetChanged | ( | ) |
Called when binding target has changed.
This should not be called for most bindings, as they only work in one direction.
bool kanzi::AbstractBindingRuntime::update | ( | ) |
Execute the binding.
Performs read from the source and write to the target.
|
inline |
Gets the owner.
|
inline |
Set the owner.
owner | Shared pointer to owner. |
|
inline |
Returns the binding associated with this binding runtime.
|
inline |
Indicates whether this binding runtime has been attached.
|
inline |
Indicates whether this binding runtime is being attached.
|
inline |
Indicates whether this binding runtime is detached.
|
inline |
Indicates whether this binding runtime is being detached.
|
inline |
Indicates whether this binding runtime is connected.
Attaching a binding causes it to be potentially connected.
|
inline |
Gets the source runtime.
|
inline |
Gets the target runtime.
void kanzi::AbstractBindingRuntime::setHost | ( | BindingHostConceptSharedPtr | hostObject | ) |
Sets the binding host object in which the binding runtime is hosted.
hostObject | The binding host object in which the binding runtime is hosted. |
void kanzi::AbstractBindingRuntime::removeFromHost | ( | ) |
Removes the binding runtime from the binding host.
When you remove a binding from a host, Kanzi detaches the binding runtime and makes the binding runtime unusable.
bool kanzi::AbstractBindingRuntime::isRemoved | ( | ) | const |
Gets whether the binding runtime has been removed from the binding host.
|
protectedpure virtual |
Binding-dependent attach.
Lookup context exists when called.
Implemented in kanzi::ManualBindingRuntime, kanzi::ToSourceBindingRuntime, kanzi::ExpressionBindingRuntime, kanzi::BindingRuntime, kanzi::TwoWayBindingRuntime, and kanzi::BindingBaseRuntime.
|
protectedpure virtual |
Binding-dependent detach.
Implemented in kanzi::ToSourceBindingRuntime, kanzi::ExpressionBindingRuntime, kanzi::TwoWayBindingRuntime, and kanzi::BindingBaseRuntime.
|
protected |
Read from source and execute forward validators.
value | Value to read to. |
|
protected |
Reads from target and executes reverse validators.
value | Value to read to. |
|
protected |
Write to target.
value | Value to write. |
|
protected |
Writes to source.
value | Value to write. |
|
protectedvirtual |
Binding-dependent source change.
Default implementation simply calls update() on the forward direction.
Reimplemented in kanzi::ToSourceBindingRuntime, kanzi::ManualBindingRuntime, and kanzi::ExpressionBindingRuntime.
|
protectedvirtual |
Binding-dependent target change.
Default implementation of throws an exception.
Reimplemented in kanzi::ToSourceBindingRuntime, and kanzi::TwoWayBindingRuntime.
|
protectedpure virtual |
Binding-dependent update.
Implemented in kanzi::ToSourceBindingRuntime, kanzi::ManualBindingRuntime, kanzi::ExpressionBindingRuntime, and kanzi::BindingBaseRuntime.
|
protectedvirtual |
Binding-dependent attached indication.
Default implementation checks source and target.
Reimplemented in kanzi::ToSourceBindingRuntime.
|
protected |
Associated binding.
|
protected |
Runtime for source.
|
protected |
Runtime for target.
|
protected |
Current binding runtime state.
A binding runtime may be attached even if it is not connected. Attach is only called once.
|
protected |
Owner for tagging the runtime.
|
protected |
The binding host object in which the binding runtime is hosted.