7 #ifndef _FCITX_UTILS_SIGNAL_DETAILS_H_ 8 #define _FCITX_UTILS_SIGNAL_DETAILS_H_ 15 #include <fcitx-utils/handlertable.h> 16 #include <fcitx-utils/intrusivelist.h> 18 #include <fcitx-utils/tuplehelpers.h> 22 template <
typename Ret,
typename... Args>
25 Invoker(Args &...args) : args_(args...) {}
27 template <
typename Func>
28 Ret operator()(
const Func &func) {
29 return callWithTuple(func, args_);
33 std::tuple<Args &...> args_;
39 template <
typename Ret,
typename... Args>
42 using iterator_category = std::input_iterator_tag;
43 using function_type = std::function<Ret(Args...)>;
44 using value_type =
typename function_type::result_type;
45 using difference_type = std::ptrdiff_t;
46 using reference = value_type;
52 : parentIter_(iter), invoker_(invoker) {}
58 bool operator==(
const iterator &other)
const noexcept {
59 return parentIter_ == other.parentIter_;
61 bool operator!=(
const iterator &other)
const noexcept {
62 return !operator==(other);
71 auto old = parentIter_;
73 return {invoker_, old};
76 reference operator*() {
return invoker_(*parentIter_); }
79 super_iterator parentIter_;
83 template <
typename Invoker,
typename Iter>
85 MakeSlotInvokeIterator(
Invoker &invoker, Iter iter) {
86 return {invoker, iter};
94 : entry_(std::move(entry)) {}
99 std::unique_ptr<HandlerTableEntryBase> entry_;
103 #endif // _FCITX_UTILS_SIGNAL_DETAILS_H_
Utitliy classes for statically tracking the life of a object.
Helper class to be used with TrackableObjectReference.