KDDockWidgets API Documentation 2.0
Loading...
Searching...
No Matches
make_node.h
Go to the documentation of this file.
1/*
2 This file is part of KDBindings.
3
4 SPDX-FileCopyrightText: 2021-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5 Author: Sean Harmer <sean.harmer@kdab.com>
6
7 SPDX-License-Identifier: MIT
8
9 Contact KDAB at <info@kdab.com> for commercial licensing options.
10*/
11
12#pragma once
13
14#include <kdbindings/node.h>
15#include <type_traits>
16
17namespace KDBindings {
18
19namespace Private {
20
21template<typename T>
23 using type = T;
24};
25
26template<typename T>
28 using type = T;
29};
30
31template<typename T>
33 using type = T;
34};
35
36template<typename T>
38 using type = T;
39};
40
41template<typename T>
42struct bindable_value_type : bindable_value_type_<std::decay_t<T>> {
43};
44
45template<typename T>
47
48// Find the type of a Node wrapping an operator and arguments
49template<typename Operator, typename... Ts>
51 std::decay<
52 std::invoke_result_t<
53 std::decay_t<Operator>,
55
56template<typename Operator, typename... Ts>
58
59// Node creation helpers
60template<typename T>
62{
63 return Node<std::decay_t<T>>(std::make_unique<ConstantNode<std::decay_t<T>>>(std::move(value)));
64}
65
66template<typename T>
67inline Node<T> makeNode(Property<T> &property)
68{
69 return Node<T>(std::make_unique<PropertyNode<T>>(property));
70}
71
72template<typename T>
74{
75 return std::move(node);
76}
77
78template<typename Operator, typename... Ts, typename = std::enable_if_t<sizeof...(Ts) >= 1>, typename ResultType = operator_node_result_t<Operator, Ts...>>
80{
81 return Node<ResultType>(std::make_unique<OperatorNode<ResultType, std::decay_t<Operator>, bindable_value_type_t<Ts>...>>(
82 std::forward<Operator>(op),
83 makeNode(std::forward<Ts>(args))...));
84}
85
86// Needed by function and operator helpers
87template<typename T>
88struct is_bindable : std::integral_constant<
89 bool,
90 is_property<T>::value || is_node<T>::value> {
91};
92
93} // namespace Private
94
95} // namespace KDBindings
A property represents a value that can be part of or the result of data binding.
Definition property.h:138
typename bindable_value_type< T >::type bindable_value_type_t
Definition make_node.h:46
std::decay< std::invoke_result_t< std::decay_t< Operator >, bindable_value_type_t< Ts >... > > operator_node_result
Definition make_node.h:54
typename operator_node_result< Operator, Ts... >::type operator_node_result_t
Definition make_node.h:57
Node< std::decay_t< T > > makeNode(T &&value)
Definition make_node.h:61
The main namespace of the KDBindings library.
Definition binding.h:21

© 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