/* This file is part of KDBindings. SPDX-FileCopyrightText: 2021 Klarälvdalens Datakonsult AB, a KDAB Group company Author: Sean Harmer SPDX-License-Identifier: MIT Contact KDAB at for commercial licensing options. */ #pragma once #include #include namespace KDBindings { namespace Private { template struct bindable_value_type_ { using type = T; }; template struct bindable_value_type_> { using type = T; }; template struct bindable_value_type_> { using type = T; }; template struct bindable_value_type_> { using type = T; }; template struct bindable_value_type_> { using type = T; }; template struct bindable_value_type : bindable_value_type_> { }; template using bindable_value_type_t = typename bindable_value_type::type; // Find the type of a Node wrapping an operator and arguments template using operator_node_result = std::decay< std::invoke_result_t< std::decay_t, bindable_value_type_t...>>; template using operator_node_result_t = typename operator_node_result::type; // Node creation helpers template inline Node> makeNode(T &&value) { return Node>(std::make_unique>>(std::move(value))); } template inline Node makeNode(Property &property) { return Node(std::make_unique>(property)); } template inline Node makeNode(const Property &property) { return Node(std::make_unique>(property)); } template inline Node makeNode(Node &&node) { return std::move(node); } template= 1>, typename ResultType = operator_node_result_t> inline Node makeNode(Operator &&op, Ts &&...args) { return Node(std::make_unique, bindable_value_type_t...>>( std::forward(op), makeNode(std::forward(args))...)); } // Needed by function and operator helpers template struct is_bindable : std::integral_constant< bool, is_property::value || is_node::value> { }; } // namespace Private } // namespace KDBindings