Skip to content

KDBindings

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

Classes

Name
class KDBindings::Binding
A combination of a root Node with an evaluator.
class KDBindings::Binding< T, ImmediateBindingEvaluator >
Provides a convenience for old-school, immediate mode Bindings.
class KDBindings::BindingEvaluator
A BindingEvaluator provides a mechanism to control the exact time when a KDBindings::Binding is reevaluated.
class KDBindings::ConnectionBlocker
A ConnectionBlocker is a convenient RAII-style mechanism for temporarily blocking a connection.
class KDBindings::ConnectionHandle
A ConnectionHandle represents the connection of a Signal to a slot (i.e. a function that is called when the Signal is emitted).
struct KDBindings::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.
class KDBindings::ImmediateBindingEvaluator
struct KDBindings::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.
class KDBindings::Property
A property represents a value that can be part of or the result of data binding.
class KDBindings::PropertyDestroyedError
A PropertyDestroyedError is thrown whenever a binding is evaluated that references a property that no longer exists.
class KDBindings::PropertyUpdater
A PropertyUpdater defines the interface used to update a Property, e.g. from a binding expression.
struct KDBindings::ReadOnlyProperty
class KDBindings::Signal
A Signal provides a mechanism for communication between objects.

Functions

Name
template <typename EvaluatorT ,typename Func ,typename... Args,typename =std::enable_if_t,typename ResultType =Private::operator_node_result_t>
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.
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.
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.
template <typename Func ,typename... Args,typename =std::enable_if_t,typename ResultType =Private::operator_node_result_t>
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.
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.
template <typename T >
std::unique_ptr< Binding< T, ImmediateBindingEvaluator > >
makeBinding(Property< T > & property)
Helper function to create an immediate mode Binding from a Property.
template <typename... T>
auto
makeBoundProperty(T &&... args)
Helper function to create a Property with a Binding.
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.

Functions Documentation

function makeBinding

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
template <typename EvaluatorT ,
typename Func ,
typename... Args,
typename  =std::enable_if_t<sizeof...(Args) != 0>,
typename ResultType  =Private::operator_node_result_t<Func, Args...>>
inline 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.

Parameters:

  • evaluator The evaluator that is used to evaluate the Binding.
  • func The function object.
  • args The function arguments - Possible values include: Properties, Constants and Nodes They will be automatically unwrapped, i.e. a Property will pass a value of type T to func.

Template Parameters:

  • EvaluatorT The type of the evaluator that is used to evaluate the Binding.
  • Func The type of the function - may be any type that implements operator().
  • Args The function argument types

Return: std::unique_ptr> 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.

function makeBinding

1
2
3
4
5
6
template <typename T ,
typename EvaluatorT >
inline std::unique_ptr< Binding< T, EvaluatorT > > makeBinding(
    EvaluatorT & evaluator,
    Private::Node< T > && rootNode
)

Helper function to create a Binding from a root Node.

Parameters:

  • evaluator The evaluator that is used to evaluate the Binding.
  • rootNode Represents the expression that will be evaluated by the Binding.

Template Parameters:

  • T The type of the value that the Binding expression evaluates to.
  • EvaluatorT The type of the evaluator that is used to evaluate the Binding.

Return: std::unique_ptr> 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.

function makeBinding

1
2
3
4
5
6
template <typename T ,
typename EvaluatorT >
inline std::unique_ptr< Binding< T, EvaluatorT > > makeBinding(
    EvaluatorT & evaluator,
    Property< T > & property
)

Helper function to create a Binding from a Property.

Parameters:

  • evaluator The evaluator that is used to evaluate the Binding.
  • property The Property to create a Binding from.

Template Parameters:

  • T The type of the value that the Binding expression evaluates to.
  • EvaluatorT The type of the evaluator that is used to evaluate the Binding.

Return: std::unique_ptr> 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.

function makeBinding

1
2
3
4
5
6
7
8
template <typename Func ,
typename... Args,
typename  =std::enable_if_t<sizeof...(Args) != 0>,
typename ResultType  =Private::operator_node_result_t<Func, Args...>>
inline 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.

Parameters:

  • func The function object.
  • args The function arguments - Possible values include: Properties, Constants and Nodes They will be automatically unwrapped, i.e. a Property will pass a value of type T to func.

Template Parameters:

  • Func The type of the function - may be any type that implements operator().
  • Args The function argument types

Return: std::unique_ptr> 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.

function makeBinding

1
2
3
4
template <typename T >
inline std::unique_ptr< Binding< T, ImmediateBindingEvaluator > > makeBinding(
    Private::Node< T > && rootNode
)

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

Parameters:

  • rootNode Represents the expression that will be evaluated by the Binding. Typically constructed from a unary/binary operator on a Property.

Template Parameters:

  • T The type of the value that the Binding expression evaluates to.

Return: std::unique_ptr<Binding<> 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.

function makeBinding

1
2
3
4
template <typename T >
inline std::unique_ptr< Binding< T, ImmediateBindingEvaluator > > makeBinding(
    Property< T > & property
)

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

Parameters:

Template Parameters:

  • T The type of the value that the Binding expression evaluates to.

Return: std::unique_ptr> 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.

function makeBoundProperty

1
2
3
4
template <typename... T>
inline auto makeBoundProperty(
    T &&... args
)

Helper function to create a Property with a Binding.

Return: Property A new Property that is bound to the inputs

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:

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

function operator<<

1
2
3
4
5
template <typename T >
std::ostream & operator<<(
    std::ostream & stream,
    Property< T > const & property
)

Outputs the value of the Property onto an output stream.

function operator>>

1
2
3
4
5
template <typename T >
std::istream & 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().


Updated on 2024-04-14 at 00:00:43 +0000