Simplify Handle::initialize template parameter
This commit is contained in:
parent
113a35b039
commit
dc0b74e07f
@ -53,7 +53,7 @@ public:
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool init() {
|
||||
return initialize<uv_async_t>(&uv_async_init, &sendCallback);
|
||||
return initialize(&uv_async_init, &sendCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -49,7 +49,7 @@ public:
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool init() {
|
||||
return initialize<uv_check_t>(&uv_check_init);
|
||||
return initialize(&uv_check_init);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -109,7 +109,7 @@ public:
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool init() {
|
||||
return initialize<uv_fs_event_t>(&uv_fs_event_init);
|
||||
return initialize(&uv_fs_event_init);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -73,7 +73,7 @@ public:
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool init() {
|
||||
return initialize<uv_fs_poll_t>(&uv_fs_poll_init);
|
||||
return initialize(&uv_fs_poll_init);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -43,10 +43,10 @@ protected:
|
||||
*buf = uv_buf_init(new char[suggested], suggested);
|
||||
}
|
||||
|
||||
template<typename H, typename F, typename... Args>
|
||||
template<typename F, typename... Args>
|
||||
bool initialize(F &&f, Args&&... args) {
|
||||
if(!this->self()) {
|
||||
auto err = std::forward<F>(f)(this->parent(), this->template get<H>(), std::forward<Args>(args)...);
|
||||
auto err = std::forward<F>(f)(this->parent(), this->get(), std::forward<Args>(args)...);
|
||||
|
||||
if(err) {
|
||||
this->publish(ErrorEvent{err});
|
||||
|
||||
@ -56,7 +56,7 @@ public:
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool init() {
|
||||
return initialize<uv_idle_t>(&uv_idle_init);
|
||||
return initialize(&uv_idle_init);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -44,7 +44,7 @@ public:
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool init() {
|
||||
return initialize<uv_pipe_t>(&uv_pipe_init, ipc);
|
||||
return initialize(&uv_pipe_init, ipc);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -109,8 +109,8 @@ public:
|
||||
*/
|
||||
bool init() {
|
||||
return (tag == SOCKET)
|
||||
? initialize<uv_poll_t>(&uv_poll_init_socket, socket)
|
||||
: initialize<uv_poll_t>(&uv_poll_init, fd);
|
||||
? initialize(&uv_poll_init_socket, socket)
|
||||
: initialize(&uv_poll_init, fd);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -49,7 +49,7 @@ public:
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool init() {
|
||||
return initialize<uv_prepare_t>(&uv_prepare_init);
|
||||
return initialize(&uv_prepare_init);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -65,7 +65,7 @@ public:
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool init() {
|
||||
return initialize<uv_signal_t>(&uv_signal_init);
|
||||
return initialize(&uv_signal_init);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -73,8 +73,8 @@ public:
|
||||
*/
|
||||
bool init() {
|
||||
return (tag == FLAGS)
|
||||
? initialize<uv_tcp_t>(&uv_tcp_init_ex, flags)
|
||||
: initialize<uv_tcp_t>(&uv_tcp_init);
|
||||
? initialize(&uv_tcp_init_ex, flags)
|
||||
: initialize(&uv_tcp_init);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -51,7 +51,7 @@ public:
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool init() {
|
||||
return initialize<uv_timer_t>(&uv_timer_init);
|
||||
return initialize(&uv_timer_init);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -81,7 +81,7 @@ public:
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool init() {
|
||||
return initialize<uv_tty_t>(&uv_tty_init, fd, rw);
|
||||
return initialize(&uv_tty_init, fd, rw);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -165,8 +165,8 @@ public:
|
||||
*/
|
||||
bool init() {
|
||||
return (tag == FLAGS)
|
||||
? initialize<uv_udp_t>(&uv_udp_init_ex, flags)
|
||||
: initialize<uv_udp_t>(&uv_udp_init);
|
||||
? initialize(&uv_udp_init_ex, flags)
|
||||
: initialize(&uv_udp_init);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user