KDBindings API Documentation  1.0.95
Classes | Functions
KDBindings Namespace Reference

The main namespace of the KDBindings library. More...

Classes

class  Binding
 A combination of a root Node with an evaluator. More...
 
class  Binding< T, ImmediateBindingEvaluator >
 Provides a convenience for old-school, immediate mode Bindings. More...
 
class  BindingEvaluator
 A BindingEvaluator provides a mechanism to control the exact time when a KDBindings::Binding is reevaluated. More...
 
class  ConnectionBlocker
 A ConnectionBlocker is a convenient RAII-style mechanism for temporarily blocking a connection. More...
 
class  ConnectionEvaluator
 Manages and evaluates deferred Signal connections. More...
 
class  ConnectionHandle
 A ConnectionHandle represents the connection of a Signal to a slot (i.e. a function that is called when the Signal is emitted). More...
 
struct  equal_to
 An instance of the KDBindings::equal_to struct is used to decide whether two values of type T are equal in the context of data binding. More...
 
class  ImmediateBindingEvaluator
 
struct  node_abs
 An example struct that is used with a call to KDBINDINGS_DECLARE_FUNCTION to declare all overloads of std::abs as usable in data binding. More...
 
class  Property
 A property represents a value that can be part of or the result of data binding. More...
 
class  PropertyDestroyedError
 A PropertyDestroyedError is thrown whenever a binding is evaluated that references a property that no longer exists. More...
 
class  PropertyUpdater
 A PropertyUpdater defines the interface used to update a Property, e.g. from a binding expression. More...
 
struct  ReadOnlyProperty
 
class  ScopedConnection
 A ScopedConnection is a RAII-style way to make sure a Connection is disconnected. More...
 
class  Signal
 A Signal provides a mechanism for communication between objects. More...
 

Functions

template<typename T >
std::unique_ptr< Binding< T, ImmediateBindingEvaluator > > makeBinding (const Property< T > &property)
 Creates an immediate mode binding from a const property. More...
 
template<typename T , typename EvaluatorT >
std::unique_ptr< Binding< T, EvaluatorT > > makeBinding (EvaluatorT &evaluator, const Property< T > &property)
 Creates a binding from a const property using a specified evaluator. More...
 
template<typename EvaluatorT , typename Func , typename... Args, typename = std::enable_if_t<sizeof...(Args) != 0>, typename ResultType = Private::operator_node_result_t<Func, Args...>>
std::unique_ptr< Binding< ResultType, EvaluatorT > > makeBinding (EvaluatorT &evaluator, Func &&func, Args &&...args)
 Helper function to create a Binding from a function and its arguments. More...
 
template<typename T , typename EvaluatorT >
std::unique_ptr< Binding< T, EvaluatorT > > makeBinding (EvaluatorT &evaluator, Private::Node< T > &&rootNode)
 Helper function to create a Binding from a root Node. More...
 
template<typename T , typename EvaluatorT >
std::unique_ptr< Binding< T, EvaluatorT > > makeBinding (EvaluatorT &evaluator, Property< T > &property)
 Helper function to create a Binding from a Property. More...
 
template<typename Func , typename... Args, typename = std::enable_if_t<sizeof...(Args) != 0>, typename ResultType = Private::operator_node_result_t<Func, Args...>>
std::unique_ptr< Binding< ResultType, ImmediateBindingEvaluator > > makeBinding (Func &&func, Args &&...args)
 Helper function to create an immediate mode Binding from a function and its arguments. More...
 
template<typename T >
std::unique_ptr< Binding< T, ImmediateBindingEvaluator > > makeBinding (Private::Node< T > &&rootNode)
 Helper function to create an immediate mode Binding from a root Node. More...
 
template<typename T >
std::unique_ptr< Binding< T, ImmediateBindingEvaluator > > makeBinding (Property< T > &property)
 Helper function to create an immediate mode Binding from a Property. More...
 
template<typename... T>
auto makeBoundProperty (T &&...args)
 Helper function to create a Property with a Binding. More...
 
template<typename T >
std::ostream & operator<< (std::ostream &stream, Property< T > const &property)
 
template<typename T >
std::istream & operator>> (std::istream &stream, Property< T > &prop)
 

Detailed Description

The main namespace of the KDBindings library.

All public parts of KDBindings are members of this namespace.

Function Documentation

◆ makeBinding() [1/8]

template<typename T >
std::unique_ptr<Binding<T, ImmediateBindingEvaluator> > KDBindings::makeBinding ( const Property< T > &  property)
inline

Creates an immediate mode binding from a const property.

Template Parameters
TThe type of the value that the Binding expression evaluates to.
Parameters
propertyThe const Property to create a Binding from.
Returns
std::unique_ptr<Binding<T, ImmediateBindingEvaluator>> A new Binding that is powered by an immediate mode evaluator, ensuring quick updates to changes.

Note: This binding type is especially suited for scenarios where you need to reflect changes in a property to some dependent components without the need to alter the source property itself.

Definition at line 261 of file binding.h.

◆ makeBinding() [2/8]

template<typename T , typename EvaluatorT >
std::unique_ptr<Binding<T, EvaluatorT> > KDBindings::makeBinding ( EvaluatorT &  evaluator,
const Property< T > &  property 
)
inline

Creates a binding from a const property using a specified evaluator.

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.
Parameters
evaluatorThe evaluator that is used to evaluate the Binding.
propertyThe const Property to create a Binding from.
Returns
std::unique_ptr<Binding<T, EvaluatorT>> A new Binding that is powered by the evaluator.

Note: Using a const Property ensures that the source cannot be modified through this binding, maintaining data integrity and supporting scenarios where data should only be observed, not altered.

Definition at line 141 of file binding.h.

◆ makeBinding() [3/8]

template<typename EvaluatorT , typename Func , typename... Args, typename = std::enable_if_t<sizeof...(Args) != 0>, typename ResultType = Private::operator_node_result_t<Func, Args...>>
std::unique_ptr<Binding<ResultType, EvaluatorT> > KDBindings::makeBinding ( EvaluatorT &  evaluator,
Func &&  func,
Args &&...  args 
)
inline

Helper function to create a Binding from a function and its arguments.

Template Parameters
EvaluatorTThe type of the evaluator that is used to evaluate the Binding.
Parameters
evaluatorThe evaluator that is used to evaluate the Binding.
Template Parameters
FuncThe type of the function - may be any type that implements operator().
Parameters
funcThe function object.
Template Parameters
ArgsThe function argument types
Parameters
argsThe function arguments - Possible values include: Properties, Constants and Nodes They will be automatically unwrapped, i.e. a Property<T> will pass a value of type T to func.
Returns
std::unique_ptr<Binding<ReturnType, EvaluatorT>> where ReturnType is the type that results from evaluationg func with the given arguments. The Binding will be powered by the new evaluator.

Note: For the difference between makeBinding and makeBoundProperty, see the "Reassigning a Binding" section in the Getting Started guide.

Definition at line 181 of file binding.h.

◆ makeBinding() [4/8]

template<typename T , typename EvaluatorT >
std::unique_ptr<Binding<T, EvaluatorT> > KDBindings::makeBinding ( EvaluatorT &  evaluator,
Private::Node< T > &&  rootNode 
)
inline

Helper function to create a Binding from a root Node.

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.
Parameters
evaluatorThe evaluator that is used to evaluate the Binding.
rootNodeRepresents the expression that will be evaluated by the Binding.
Returns
std::unique_ptr<Binding<T, EvaluatorT>> A new Binding that combines the rootNode with the evaluator.

Note: For the difference between makeBinding and makeBoundProperty, see the "Reassigning a Binding" section in the Getting Started guide.

Definition at line 159 of file binding.h.

◆ makeBinding() [5/8]

template<typename T , typename EvaluatorT >
std::unique_ptr<Binding<T, EvaluatorT> > KDBindings::makeBinding ( EvaluatorT &  evaluator,
Property< T > &  property 
)
inline

Helper function to create a Binding from a Property.

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.
Parameters
evaluatorThe evaluator that is used to evaluate the Binding.
propertyThe Property to create a Binding from.
Returns
std::unique_ptr<Binding<T, EvaluatorT>> A new Binding that is powered by the evaluator.

Note: For the difference between makeBinding and makeBoundProperty, see the "Reassigning a Binding" section in the Getting Started guide.

Definition at line 123 of file binding.h.

Referenced by makeBoundProperty().

◆ makeBinding() [6/8]

template<typename Func , typename... Args, typename = std::enable_if_t<sizeof...(Args) != 0>, typename ResultType = Private::operator_node_result_t<Func, Args...>>
std::unique_ptr<Binding<ResultType, ImmediateBindingEvaluator> > KDBindings::makeBinding ( Func &&  func,
Args &&...  args 
)
inline

Helper function to create an immediate mode Binding from a function and its arguments.

Template Parameters
FuncThe type of the function - may be any type that implements operator().
Parameters
funcThe function object.
Template Parameters
ArgsThe function argument types
Parameters
argsThe function arguments - Possible values include: Properties, Constants and Nodes They will be automatically unwrapped, i.e. a Property<T> will pass a value of type T to func.
Returns
std::unique_ptr<Binding<ReturnType, ImmediateBindingEvaluator>> where ReturnType is the type that results from evaluationg func with the given arguments. The Binding will feature immediate evaluation.

Note: For the difference between makeBinding and makeBoundProperty, see the "Reassigning a Binding" section in the Getting Started guide.

Definition at line 298 of file binding.h.

◆ makeBinding() [7/8]

template<typename T >
std::unique_ptr<Binding<T, ImmediateBindingEvaluator> > KDBindings::makeBinding ( Private::Node< T > &&  rootNode)
inline

Helper function to create an immediate mode Binding from a root Node.

Template Parameters
TThe type of the value that the Binding expression evaluates to.
Parameters
rootNodeRepresents the expression that will be evaluated by the Binding. Typically constructed from a unary/binary operator on a Property.
Returns
std::unique_ptr<Binding<<T, ImmediateBindingEvaluator>> An new Binding bound to a root Node with immediate evaluation.

Note: For the difference between makeBinding and makeBoundProperty, see the "Reassigning a Binding" section in the Getting Started guide.

Definition at line 278 of file binding.h.

◆ makeBinding() [8/8]

template<typename T >
std::unique_ptr<Binding<T, ImmediateBindingEvaluator> > KDBindings::makeBinding ( Property< T > &  property)
inline

Helper function to create an immediate mode Binding from a Property.

Template Parameters
TThe type of the value that the Binding expression evaluates to.
Parameters
propertyThe Property to create a Binding from.
Returns
std::unique_ptr<Binding<T, ImmediateBindingEvaluator>> An new Binding bound to an existing Property with immediate evaluation.

Note: For the difference between makeBinding and makeBoundProperty, see the "Reassigning a Binding" section in the Getting Started guide.

Definition at line 243 of file binding.h.

◆ makeBoundProperty()

template<typename... T>
auto KDBindings::makeBoundProperty ( T &&...  args)
inline

Helper function to create a Property with a Binding.

This function can take:

  • Another Property.
  • A Node, typically created by combining Property instances using operators.
  • A function with arguments (Nodes, Constants or Properties) By default this will construct a Property with an immediate binding evaluation.

Alternatively a BindingEvaluator can be passed as the first argument to this function to control when evaluation takes place.

See the documentation for the various overloads of the free makeBinding function for a detailed description of which arguments can be used in which order.

Examples:

Returns
Property A new Property that is bound to the inputs

Note: For the difference between makeBinding and makeBoundProperty, see the "Reassigning a Binding" section in the Getting Started guide.

Examples
05-property-bindings/main.cpp, and 06-lazy-property-bindings/main.cpp.

Definition at line 328 of file binding.h.

References makeBinding().

◆ operator<<()

template<typename T >
std::ostream& KDBindings::operator<< ( std::ostream &  stream,
Property< T > const &  property 
)

Outputs the value of the Property onto an output stream.

Definition at line 399 of file property.h.

◆ operator>>()

template<typename T >
std::istream& KDBindings::operator>> ( std::istream &  stream,
Property< T > &  prop 
)

Reads a value of type T from the input stream and assigns it to the Property using set().

Definition at line 410 of file property.h.

References KDBindings::Property< T >::set().


© 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