27#ifndef SDBUS_CXX_TYPETRAITS_H_
28#define SDBUS_CXX_TYPETRAITS_H_
42 template <
typename... _ValueTypes>
class Struct;
50 class PropertySetCall;
51 class PropertyGetReply;
52 template <
typename... _Results>
class Result;
59 using method_callback = std::function<void(MethodCall msg)>;
60 using async_reply_handler = std::function<void(MethodReply& reply,
const Error* error)>;
61 using signal_handler = std::function<void(Signal& signal)>;
62 using message_handler = std::function<void(Message& msg)>;
63 using property_set_callback = std::function<void(PropertySetCall& msg)>;
64 using property_get_callback = std::function<void(PropertyGetReply& reply)>;
67 using Slot = std::unique_ptr<void, std::function<void(
void*)>>;
77 [[deprecated(
"Replaced by floating_slot")]]
inline constexpr dont_request_slot_t dont_request_slot{};
86 template <
typename _T>
89 static constexpr bool is_valid =
false;
91 static const std::string str()
95 static_assert(
sizeof(_T) < 0,
"Unknown DBus type");
103 static constexpr bool is_valid =
true;
105 static const std::string str()
114 static constexpr bool is_valid =
true;
116 static const std::string str()
125 static constexpr bool is_valid =
true;
127 static const std::string str()
136 static constexpr bool is_valid =
true;
138 static const std::string str()
147 static constexpr bool is_valid =
true;
149 static const std::string str()
158 static constexpr bool is_valid =
true;
160 static const std::string str()
169 static constexpr bool is_valid =
true;
171 static const std::string str()
180 static constexpr bool is_valid =
true;
182 static const std::string str()
191 static constexpr bool is_valid =
true;
193 static const std::string str()
202 static constexpr bool is_valid =
true;
204 static const std::string str()
213 static constexpr bool is_valid =
true;
215 static const std::string str()
224 static constexpr bool is_valid =
true;
226 static const std::string str()
232 template <std::
size_t _N>
235 static constexpr bool is_valid =
true;
237 static const std::string str()
243 template <std::
size_t _N>
246 static constexpr bool is_valid =
true;
248 static const std::string str()
257 static constexpr bool is_valid =
true;
259 static const std::string str()
265 template <
typename... _ValueTypes>
268 static constexpr bool is_valid =
true;
270 static const std::string str()
272 std::string signature;
283 static constexpr bool is_valid =
true;
285 static const std::string str()
294 static constexpr bool is_valid =
true;
296 static const std::string str()
305 static constexpr bool is_valid =
true;
307 static const std::string str()
316 static constexpr bool is_valid =
true;
318 static const std::string str()
324 template <
typename _Element>
327 static constexpr bool is_valid =
true;
329 static const std::string str()
335 template <
typename _Key,
typename _Value>
338 static constexpr bool is_valid =
true;
340 static const std::string str()
349 template <
typename _Type>
354 template <
typename _Type>
359 template <
typename _Type>
364 template <
typename _ReturnType,
typename... _Args>
367 typedef _ReturnType result_type;
368 typedef std::tuple<_Args...> arguments_type;
369 typedef std::tuple<std::decay_t<_Args>...> decayed_arguments_type;
371 typedef _ReturnType function_type(_Args...);
373 static constexpr std::size_t arity =
sizeof...(_Args);
390 template <
size_t _Idx>
393 typedef std::tuple_element_t<_Idx, std::tuple<_Args...>> type;
396 template <
size_t _Idx>
397 using arg_t =
typename arg<_Idx>::type;
400 template <
typename _ReturnType,
typename... _Args>
404 static constexpr bool is_async =
false;
405 static constexpr bool has_error_param =
false;
408 template <
typename... _Args>
412 static constexpr bool has_error_param =
true;
415 template <
typename... _Args,
typename... _Results>
419 static constexpr bool is_async =
true;
423 template <
typename... _Args,
typename... _Results>
427 static constexpr bool is_async =
true;
431 template <
typename _ReturnType,
typename... _Args>
436 template <
typename _ClassType,
typename _ReturnType,
typename... _Args>
440 typedef _ClassType& owner_type;
443 template <
typename _ClassType,
typename _ReturnType,
typename... _Args>
447 typedef const _ClassType& owner_type;
450 template <
typename _ClassType,
typename _ReturnType,
typename... _Args>
454 typedef volatile _ClassType& owner_type;
457 template <
typename _ClassType,
typename _ReturnType,
typename... _Args>
461 typedef const volatile _ClassType& owner_type;
464 template <
typename FunctionType>
469 template <
class _Function>
472 template <
class _Function>
475 template <
typename _FunctionType>
478 template <
typename _FunctionType,
size_t _Idx>
481 template <
typename _FunctionType>
484 template <
typename _FunctionType>
487 template <
typename _Function>
493 template <
typename _Function>
494 using tuple_of_function_input_arg_types_t =
typename tuple_of_function_input_arg_types<_Function>::type;
496 template <
typename _Function>
502 template <
typename _Function>
503 using tuple_of_function_output_arg_types_t =
typename tuple_of_function_output_arg_types<_Function>::type;
505 template <
typename _Type>
508 static const std::string str()
514 template <
typename... _Types>
517 static const std::string str()
519 std::string signature;
520 (void)(signature += ... +=
signature_of<std::decay_t<_Types>>::str());
525 template <
typename _Function>
528 static const std::string str()
534 template <
typename _Function>
537 static const std::string str()
545 template <
class _Function,
class _Tuple,
typename... _Args, std::size_t... _I>
546 constexpr decltype(
auto) apply_impl( _Function&& f
549 , std::index_sequence<_I...> )
551 return std::forward<_Function>(f)(std::move(r), std::get<_I>(std::forward<_Tuple>(t))...);
554 template <
class _Function,
class _Tuple, std::size_t... _I>
555 constexpr decltype(
auto) apply_impl( _Function&& f
558 , std::index_sequence<_I...> )
560 return std::forward<_Function>(f)(e, std::get<_I>(std::forward<_Tuple>(t))...);
565 template <
class _Function,
class _Tuple, std::size_t... _I>
566 constexpr decltype(
auto) apply_impl( _Function&& f
568 , std::index_sequence<_I...> )
570 if constexpr (!std::is_void_v<function_result_t<_Function>>)
571 return std::forward<_Function>(f)(std::get<_I>(std::forward<_Tuple>(t))...);
573 return std::forward<_Function>(f)(std::get<_I>(std::forward<_Tuple>(t))...), std::tuple<>{};
579 template <
class _Function,
class _Tuple>
580 constexpr decltype(
auto) apply(_Function&& f, _Tuple&& t)
582 return detail::apply_impl( std::forward<_Function>(f)
583 , std::forward<_Tuple>(t)
584 , std::make_index_sequence<std::tuple_size<std::decay_t<_Tuple>>::value>{} );
589 template <
class _Function,
class _Tuple,
typename... _Args>
590 constexpr decltype(
auto) apply(_Function&& f, Result<_Args...>&& r, _Tuple&& t)
592 return detail::apply_impl( std::forward<_Function>(f)
594 , std::forward<_Tuple>(t)
595 , std::make_index_sequence<std::tuple_size<std::decay_t<_Tuple>>::value>{} );
600 template <
class _Function,
class _Tuple>
601 constexpr decltype(
auto) apply(_Function&& f,
const Error* e, _Tuple&& t)
603 return detail::apply_impl( std::forward<_Function>(f)
605 , std::forward<_Tuple>(t)
606 , std::make_index_sequence<std::tuple_size<std::decay_t<_Tuple>>::value>{} );
Definition: MethodResult.h:50
Definition: TypeTraits.h:82
Definition: TypeTraits.h:79
Definition: TypeTraits.h:507
Definition: TypeTraits.h:76
Definition: TypeTraits.h:73
Definition: TypeTraits.h:392
Definition: TypeTraits.h:366
Definition: TypeTraits.h:352
Definition: TypeTraits.h:70
Definition: TypeTraits.h:536
Definition: TypeTraits.h:88
Definition: TypeTraits.h:498