1 #ifndef LIBFILEZILLA_EVENT_HANDLER 2 #define LIBFILEZILLA_EVENT_HANDLER 73 void remove_handler();
81 virtual void operator()(
event_base const&) = 0;
89 template<
typename T,
typename... Args>
90 void send_event(Args&&... args) {
91 event_loop_.send_event(
this,
new T(std::forward<Args>(args)...));
95 void send_event(T* evt) {
96 event_loop_.send_event(
this, evt);
115 timer_id add_timer(
duration const& interval,
bool one_shot);
121 void stop_timer(timer_id
id);
143 template<
typename T,
typename F>
146 bool const same = same_type<T>(ev);
148 T
const* e =
static_cast<T const*
>(&ev);
149 apply(std::forward<F>(f), e->v_);
169 template<
typename T,
typename H,
typename F>
172 bool const same = same_type<T>(ev);
174 T
const* e =
static_cast<T const*
>(&ev);
175 apply(h, std::forward<F>(f), e->v_);
198 template<
typename T,
typename ... Ts,
typename H,
typename F,
typename ... Fs>
201 if (dispatch<T>(ev, h, std::forward<F>(f))) {
205 return dispatch<Ts...>(ev, h, std::forward<Fs>(fs)...);
auto apply(F &&f, Tuple &&args) -> decltype(apply_(std::forward< F >(f), std::forward< Tuple >(args), Seq()))
Apply tuple to ordinary functor.
Definition: apply.hpp:43
Simple handler for asynchronous event processing.
Definition: event_handler.hpp:54
bool dispatch(event_base const &ev, F &&f)
Dispatch for simple_event<> based events to simple functors.
Definition: event_handler.hpp:144
A simple threaded event loop for the typesafe event system.
A threaded event loop that supports sending events and timers.
Definition: event_loop.hpp:30
The namespace used by libfilezilla.
Definition: apply.hpp:16
The duration class represents a time interval in milliseconds.
Definition: time.hpp:271
Common base class for all events.
Definition: event.hpp:21