27#ifndef SDBUS_CXX_TYPETRAITS_H_ 
   28#define SDBUS_CXX_TYPETRAITS_H_ 
   34#if __cplusplus >= 202002L 
   38#include <unordered_map> 
   47    template <
typename... _ValueTypes> 
class Struct;
 
   55    class PropertySetCall;
 
   56    class PropertyGetReply;
 
   57    template <
typename... _Results> 
class Result;
 
   64    using method_callback = std::function<void(MethodCall msg)>;
 
   65    using async_reply_handler = std::function<void(MethodReply& reply, 
const Error* error)>;
 
   66    using signal_handler = std::function<void(Signal& signal)>;
 
   67    using message_handler = std::function<void(Message& msg)>;
 
   68    using property_set_callback = std::function<void(PropertySetCall& msg)>;
 
   69    using property_get_callback = std::function<void(PropertyGetReply& reply)>;
 
   72    using Slot = std::unique_ptr<void, std::function<void(
void*)>>;
 
   82    [[deprecated(
"Replaced by floating_slot")]] 
inline constexpr dont_request_slot_t dont_request_slot{};
 
  101    template <
typename _T>
 
  104        static constexpr bool is_valid = 
false;
 
  105        static constexpr bool is_trivial_dbus_type = 
false;
 
  107        static const std::string str()
 
  111            static_assert(
sizeof(_T) < 0, 
"Unknown DBus type");
 
 
  116    template <
typename _T>
 
  121    template <
typename _T>
 
  123            : 
public signature_of<_T>
 
 
  129        static constexpr bool is_valid = 
true;
 
  130        static constexpr bool is_trivial_dbus_type = 
false;
 
  132        static const std::string str()
 
 
  141        static constexpr bool is_valid = 
true;
 
  142        static constexpr bool is_trivial_dbus_type = 
true;
 
  144        static const std::string str()
 
 
  153        static constexpr bool is_valid = 
true;
 
  154        static constexpr bool is_trivial_dbus_type = 
true;
 
  156        static const std::string str()
 
 
  165        static constexpr bool is_valid = 
true;
 
  166        static constexpr bool is_trivial_dbus_type = 
true;
 
  168        static const std::string str()
 
 
  177        static constexpr bool is_valid = 
true;
 
  178        static constexpr bool is_trivial_dbus_type = 
true;
 
  180        static const std::string str()
 
 
  189        static constexpr bool is_valid = 
true;
 
  190        static constexpr bool is_trivial_dbus_type = 
true;
 
  192        static const std::string str()
 
 
  201        static constexpr bool is_valid = 
true;
 
  202        static constexpr bool is_trivial_dbus_type = 
true;
 
  204        static const std::string str()
 
 
  213        static constexpr bool is_valid = 
true;
 
  214        static constexpr bool is_trivial_dbus_type = 
true;
 
  216        static const std::string str()
 
 
  225        static constexpr bool is_valid = 
true;
 
  226        static constexpr bool is_trivial_dbus_type = 
true;
 
  228        static const std::string str()
 
 
  237        static constexpr bool is_valid = 
true;
 
  238        static constexpr bool is_trivial_dbus_type = 
true;
 
  240        static const std::string str()
 
 
  249        static constexpr bool is_valid = 
true;
 
  250        static constexpr bool is_trivial_dbus_type = 
false;
 
  252        static const std::string str()
 
 
  261        static constexpr bool is_valid = 
true;
 
  262        static constexpr bool is_trivial_dbus_type = 
false;
 
  264        static const std::string str()
 
 
  270    template <std::
size_t _N>
 
  273        static constexpr bool is_valid = 
true;
 
  274        static constexpr bool is_trivial_dbus_type = 
false;
 
  276        static const std::string str()
 
 
  282    template <std::
size_t _N>
 
  285        static constexpr bool is_valid = 
true;
 
  286        static constexpr bool is_trivial_dbus_type = 
false;
 
  288        static const std::string str()
 
 
  297        static constexpr bool is_valid = 
true;
 
  298        static constexpr bool is_trivial_dbus_type = 
false;
 
  300        static const std::string str()
 
 
  306    template <
typename... _ValueTypes>
 
  309        static constexpr bool is_valid = 
true;
 
  310        static constexpr bool is_trivial_dbus_type = 
false;
 
  312        static const std::string str()
 
  314            std::string signature;
 
 
  325        static constexpr bool is_valid = 
true;
 
  326        static constexpr bool is_trivial_dbus_type = 
false;
 
  328        static const std::string str()
 
 
  337        static constexpr bool is_valid = 
true;
 
  338        static constexpr bool is_trivial_dbus_type = 
false;
 
  340        static const std::string str()
 
 
  349        static constexpr bool is_valid = 
true;
 
  350        static constexpr bool is_trivial_dbus_type = 
false;
 
  352        static const std::string str()
 
 
  361        static constexpr bool is_valid = 
true;
 
  362        static constexpr bool is_trivial_dbus_type = 
false;
 
  364        static const std::string str()
 
 
  370    template <
typename _Element, 
typename _Allocator>
 
  373        static constexpr bool is_valid = 
true;
 
  374        static constexpr bool is_trivial_dbus_type = 
false;
 
  376        static const std::string str()
 
 
  382    template <
typename _Element, std::
size_t _Size>
 
  385        static constexpr bool is_valid = 
true;
 
  386        static constexpr bool is_trivial_dbus_type = 
false;
 
  388        static const std::string str()
 
 
  394#if __cplusplus >= 202002L 
  395    template <
typename _Element, std::
size_t _Extent>
 
  398        static constexpr bool is_valid = 
true;
 
  399        static constexpr bool is_trivial_dbus_type = 
false;
 
  401        static const std::string str()
 
  408    template <
typename _Key, 
typename _Value, 
typename _Compare, 
typename _Allocator>
 
  411        static constexpr bool is_valid = 
true;
 
  412        static constexpr bool is_trivial_dbus_type = 
false;
 
  414        static const std::string str()
 
 
  420    template <
typename _Key, 
typename _Value, 
typename _Hash, 
typename _KeyEqual, 
typename _Allocator>
 
  421    struct signature_of<std::unordered_map<_Key, _Value, _Hash, _KeyEqual, _Allocator>>
 
  423        static constexpr bool is_valid = 
true;
 
  424        static constexpr bool is_trivial_dbus_type = 
false;
 
  426        static const std::string str()
 
 
  435    template <
typename _Type>
 
  440    template <
typename _Type>
 
  445    template <
typename _Type>
 
  447        : 
public function_traits<_Type>
 
 
  450    template <
typename _ReturnType, 
typename... _Args>
 
  453        typedef _ReturnType result_type;
 
  454        typedef std::tuple<_Args...> arguments_type;
 
  455        typedef std::tuple<std::decay_t<_Args>...> decayed_arguments_type;
 
  457        typedef _ReturnType function_type(_Args...);
 
  459        static constexpr std::size_t arity = 
sizeof...(_Args);
 
  476        template <
size_t _Idx>
 
  479            typedef std::tuple_element_t<_Idx, std::tuple<_Args...>> type;
 
 
  482        template <
size_t _Idx>
 
  483        using arg_t = 
typename arg<_Idx>::type;
 
 
  486    template <
typename _ReturnType, 
typename... _Args>
 
  490        static constexpr bool is_async = 
false;
 
  491        static constexpr bool has_error_param = 
false;
 
 
  494    template <
typename... _Args>
 
  498        static constexpr bool has_error_param = 
true;
 
 
  501    template <
typename... _Args, 
typename... _Results>
 
  505        static constexpr bool is_async = 
true;
 
  506        using async_result_t = 
Result<_Results...>;
 
 
  509    template <
typename... _Args, 
typename... _Results>
 
  513        static constexpr bool is_async = 
true;
 
  514        using async_result_t = 
Result<_Results...>;
 
 
  517    template <
typename _ReturnType, 
typename... _Args>
 
  522    template <
typename _ClassType, 
typename _ReturnType, 
typename... _Args>
 
  526        typedef _ClassType& owner_type;
 
 
  529    template <
typename _ClassType, 
typename _ReturnType, 
typename... _Args>
 
  533        typedef const _ClassType& owner_type;
 
 
  536    template <
typename _ClassType, 
typename _ReturnType, 
typename... _Args>
 
  540        typedef volatile _ClassType& owner_type;
 
 
  543    template <
typename _ClassType, 
typename _ReturnType, 
typename... _Args>
 
  547        typedef const volatile _ClassType& owner_type;
 
 
  550    template <
typename FunctionType>
 
  555    template <
class _Function>
 
  558    template <
class _Function>
 
  561    template <
typename _FunctionType>
 
  564    template <
typename _FunctionType, 
size_t _Idx>
 
  567    template <
typename _FunctionType>
 
  570    template <
typename _FunctionType>
 
  573    template <
typename _Function>
 
  579    template <
typename _Function>
 
  580    using tuple_of_function_input_arg_types_t = 
typename tuple_of_function_input_arg_types<_Function>::type;
 
  582    template <
typename _Function>
 
  588    template <
typename _Function>
 
  589    using tuple_of_function_output_arg_types_t = 
typename tuple_of_function_output_arg_types<_Function>::type;
 
  591    template <
typename _Type>
 
  594        static const std::string str()
 
  596            return signature_of<std::decay_t<_Type>>::str();
 
 
  600    template <
typename... _Types>
 
  603        static const std::string str()
 
  605            std::string signature;
 
  606            (void)(signature += ... += 
signature_of<std::decay_t<_Types>>::str());
 
 
  611    template <
typename _Function>
 
  614        static const std::string str()
 
  616            return aggregate_signature<tuple_of_function_input_arg_types_t<_Function>>::str();
 
 
  620    template <
typename _Function>
 
  623        static const std::string str()
 
  625            return aggregate_signature<tuple_of_function_output_arg_types_t<_Function>>::str();
 
 
  632        typedef std::tuple<_Args...> type;
 
 
  645    template <
typename... _Args>
 
  646    using future_return_t = 
typename future_return<_Args...>::type;
 
  651        template <
class _Function, 
class _Tuple, 
typename... _Args, std::size_t... _I>
 
  652        constexpr decltype(
auto) apply_impl( _Function&& f
 
  653                                           , Result<_Args...>&& r
 
  655                                           , std::index_sequence<_I...> )
 
  657            return std::forward<_Function>(f)(std::move(r), std::get<_I>(std::forward<_Tuple>(t))...);
 
  660        template <
class _Function, 
class _Tuple, std::size_t... _I>
 
  661        constexpr decltype(
auto) apply_impl( _Function&& f
 
  664                                           , std::index_sequence<_I...> )
 
  666            return std::forward<_Function>(f)(e, std::get<_I>(std::forward<_Tuple>(t))...);
 
  671        template <
class _Function, 
class _Tuple, std::size_t... _I>
 
  672        constexpr decltype(
auto) apply_impl( _Function&& f
 
  674                                           , std::index_sequence<_I...> )
 
  676            if constexpr (!std::is_void_v<function_result_t<_Function>>)
 
  677                return std::forward<_Function>(f)(std::get<_I>(std::forward<_Tuple>(t))...);
 
  679                return std::forward<_Function>(f)(std::get<_I>(std::forward<_Tuple>(t))...), std::tuple<>{};
 
  685    template <
class _Function, 
class _Tuple>
 
  686    constexpr decltype(
auto) apply(_Function&& f, _Tuple&& t)
 
  688        return detail::apply_impl( std::forward<_Function>(f)
 
  689                                 , std::forward<_Tuple>(t)
 
  690                                 , std::make_index_sequence<std::tuple_size<std::decay_t<_Tuple>>::value>{} );
 
  695    template <
class _Function, 
class _Tuple, 
typename... _Args>
 
  696    constexpr decltype(
auto) apply(_Function&& f, Result<_Args...>&& r, _Tuple&& t)
 
  698        return detail::apply_impl( std::forward<_Function>(f)
 
  700                                 , std::forward<_Tuple>(t)
 
  701                                 , std::make_index_sequence<std::tuple_size<std::decay_t<_Tuple>>::value>{} );
 
  706    template <
class _Function, 
class _Tuple>
 
  707    constexpr decltype(
auto) apply(_Function&& f, 
const Error* e, _Tuple&& t)
 
  709        return detail::apply_impl( std::forward<_Function>(f)
 
  711                                 , std::forward<_Tuple>(t)
 
  712                                 , std::make_index_sequence<std::tuple_size<std::decay_t<_Tuple>>::value>{} );
 
Definition MethodResult.h:50
Definition TypeTraits.h:87
Definition TypeTraits.h:84
Definition TypeTraits.h:593
Definition TypeTraits.h:97
Definition TypeTraits.h:81
Definition TypeTraits.h:91
Definition TypeTraits.h:78
Definition TypeTraits.h:478
Definition TypeTraits.h:452
Definition TypeTraits.h:438
Definition TypeTraits.h:631
Definition TypeTraits.h:75
Definition TypeTraits.h:622
Definition TypeTraits.h:103
Definition TypeTraits.h:584
Definition TypeTraits.h:94