clean up
This commit is contained in:
parent
f876a70710
commit
1be5ed71a0
@ -17,7 +17,7 @@ namespace uvw {
|
||||
*
|
||||
* It will be emitted by AsyncHandle according with its functionalities.
|
||||
*/
|
||||
struct AsyncEvent: Event<AsyncEvent> { };
|
||||
struct AsyncEvent: Event<AsyncEvent> {};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -19,7 +19,7 @@ namespace uvw {
|
||||
*
|
||||
* To create a `CheckHandle` through a `Loop`, no arguments are required.
|
||||
*/
|
||||
struct CheckEvent: Event<CheckEvent> { };
|
||||
struct CheckEvent: Event<CheckEvent> {};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -24,7 +24,7 @@ struct AddrInfoEvent: Event<AddrInfoEvent> {
|
||||
|
||||
AddrInfoEvent(std::unique_ptr<addrinfo, Deleter> data)
|
||||
: data{std::move(data)}
|
||||
{ }
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief An initialized instance of `addrinfo`.
|
||||
@ -44,7 +44,7 @@ struct AddrInfoEvent: Event<AddrInfoEvent> {
|
||||
struct NameInfoEvent: Event<NameInfoEvent> {
|
||||
NameInfoEvent(const char *hostname, const char *service)
|
||||
: hostname{hostname}, service{service}
|
||||
{ }
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief A valid hostname.
|
||||
|
||||
@ -140,7 +140,7 @@ public:
|
||||
|
||||
Connection(typename Handler<E>::Connection conn)
|
||||
: Handler<E>::Connection{std::move(conn)}
|
||||
{ }
|
||||
{}
|
||||
|
||||
Connection & operator=(const Connection &) = default;
|
||||
Connection & operator=(Connection &&) = default;
|
||||
|
||||
@ -13,7 +13,7 @@ namespace details {
|
||||
|
||||
|
||||
struct BaseEvent {
|
||||
virtual ~BaseEvent() noexcept { }
|
||||
virtual ~BaseEvent() noexcept {}
|
||||
|
||||
static std::size_t next() noexcept {
|
||||
static std::size_t cnt = 0;
|
||||
@ -53,7 +53,7 @@ struct ErrorEvent: Event<ErrorEvent> {
|
||||
template<typename U, typename = std::enable_if_t<std::is_integral<U>::value>>
|
||||
explicit ErrorEvent(U val) noexcept
|
||||
: ec{static_cast<int>(val)}, str{uv_strerror(ec)}
|
||||
{ }
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief Returns the error message for the given error code.
|
||||
|
||||
@ -112,7 +112,7 @@ enum class UVDirentTypeT: std::underlying_type_t<uv_dirent_type_t> {
|
||||
*/
|
||||
template<details::UVFsType e>
|
||||
struct FsEvent: Event<FsEvent<e>> {
|
||||
FsEvent(const char *path) noexcept: path{path} { }
|
||||
FsEvent(const char *path) noexcept: path{path} {}
|
||||
|
||||
const char * path; /*!< The path affecting the request. */
|
||||
};
|
||||
@ -130,7 +130,7 @@ struct FsEvent<details::UVFsType::READ>
|
||||
{
|
||||
FsEvent(const char *path, std::unique_ptr<const char[]> data, std::size_t size) noexcept
|
||||
: path{path}, data{std::move(data)}, size{size}
|
||||
{ }
|
||||
{}
|
||||
|
||||
const char * path; /*!< The path affecting the request. */
|
||||
std::unique_ptr<const char[]> data; /*!< A bunch of data read from the given path. */
|
||||
@ -150,7 +150,7 @@ struct FsEvent<details::UVFsType::WRITE>
|
||||
{
|
||||
FsEvent(const char *path, std::size_t size) noexcept
|
||||
: path{path}, size{size}
|
||||
{ }
|
||||
{}
|
||||
|
||||
const char * path; /*!< The path affecting the request. */
|
||||
std::size_t size; /*!< The amount of data written to the given path. */
|
||||
@ -169,7 +169,7 @@ struct FsEvent<details::UVFsType::SENDFILE>
|
||||
{
|
||||
FsEvent(const char *path, std::size_t size) noexcept
|
||||
: path{path}, size{size}
|
||||
{ }
|
||||
{}
|
||||
|
||||
const char * path; /*!< The path affecting the request. */
|
||||
std::size_t size; /*!< The amount of data transferred. */
|
||||
@ -188,7 +188,7 @@ struct FsEvent<details::UVFsType::STAT>
|
||||
{
|
||||
FsEvent(const char *path, Stat stat) noexcept
|
||||
: path{path}, stat{std::move(stat)}
|
||||
{ }
|
||||
{}
|
||||
|
||||
const char * path; /*!< The path affecting the request. */
|
||||
Stat stat; /*!< An initialized instance of Stat. */
|
||||
@ -207,7 +207,7 @@ struct FsEvent<details::UVFsType::FSTAT>
|
||||
{
|
||||
FsEvent(const char *path, Stat stat) noexcept
|
||||
: path{path}, stat{std::move(stat)}
|
||||
{ }
|
||||
{}
|
||||
|
||||
const char * path; /*!< The path affecting the request. */
|
||||
Stat stat; /*!< An initialized instance of Stat. */
|
||||
@ -226,7 +226,7 @@ struct FsEvent<details::UVFsType::LSTAT>
|
||||
{
|
||||
FsEvent(const char *path, Stat stat) noexcept
|
||||
: path{path}, stat{std::move(stat)}
|
||||
{ }
|
||||
{}
|
||||
|
||||
const char * path; /*!< The path affecting the request. */
|
||||
Stat stat; /*!< An initialized instance of Stat. */
|
||||
@ -245,7 +245,7 @@ struct FsEvent<details::UVFsType::SCANDIR>
|
||||
{
|
||||
FsEvent(const char *path, std::size_t size) noexcept
|
||||
: path{path}, size{size}
|
||||
{ }
|
||||
{}
|
||||
|
||||
const char * path; /*!< The path affecting the request. */
|
||||
std::size_t size; /*!< The number of directory entries selected. */
|
||||
@ -264,7 +264,7 @@ struct FsEvent<details::UVFsType::READLINK>
|
||||
{
|
||||
explicit FsEvent(const char *path, const char *data, std::size_t size) noexcept
|
||||
: path{path}, data{data}, size{size}
|
||||
{ }
|
||||
{}
|
||||
|
||||
const char * path; /*!< The path affecting the request. */
|
||||
const char * data; /*!< A bunch of data read from the given path. */
|
||||
|
||||
@ -41,7 +41,7 @@ enum class UVFsEvent: std::underlying_type_t<uv_fs_event> {
|
||||
struct FsEventEvent: Event<FsEventEvent> {
|
||||
FsEventEvent(const char * filename, Flags<details::UVFsEvent> flags)
|
||||
: filename{filename}, flags{std::move(flags)}
|
||||
{ }
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief The path to the file being monitored.
|
||||
|
||||
@ -22,7 +22,7 @@ namespace uvw {
|
||||
struct FsPollEvent: Event<FsPollEvent> {
|
||||
explicit FsPollEvent(Stat prev, Stat curr) noexcept
|
||||
: prev{std::move(prev)}, curr{std::move(curr)}
|
||||
{ }
|
||||
{}
|
||||
|
||||
Stat prev; /*!< The old Stat struct. */
|
||||
Stat curr; /*!< The new Stat struct. */
|
||||
|
||||
@ -17,7 +17,7 @@ namespace uvw {
|
||||
*
|
||||
* It will be emitted by the handles according with their functionalities.
|
||||
*/
|
||||
struct CloseEvent: Event<CloseEvent> { };
|
||||
struct CloseEvent: Event<CloseEvent> {};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -17,7 +17,7 @@ namespace uvw {
|
||||
*
|
||||
* It will be emitted by IdleHandle according with its functionalities.
|
||||
*/
|
||||
struct IdleEvent: Event<IdleEvent> { };
|
||||
struct IdleEvent: Event<IdleEvent> {};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -125,7 +125,7 @@ class Loop final: public Emitter<Loop>, public std::enable_shared_from_this<Loop
|
||||
|
||||
Loop(std::unique_ptr<uv_loop_t, Deleter> ptr) noexcept
|
||||
: loop{std::move(ptr)}
|
||||
{ }
|
||||
{}
|
||||
|
||||
public:
|
||||
using Time = std::chrono::milliseconds;
|
||||
|
||||
@ -31,7 +31,7 @@ class PipeHandle final: public StreamHandle<PipeHandle, uv_pipe_t> {
|
||||
public:
|
||||
explicit PipeHandle(ConstructorAccess ca, std::shared_ptr<Loop> ref, bool pass = false)
|
||||
: StreamHandle{std::move(ca), std::move(ref)}, ipc{pass}
|
||||
{ }
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief Initializes the handle.
|
||||
|
||||
@ -34,7 +34,7 @@ enum class UVPollEvent: std::underlying_type_t<uv_poll_event> {
|
||||
struct PollEvent: Event<PollEvent> {
|
||||
explicit PollEvent(Flags<details::UVPollEvent> flags) noexcept
|
||||
: flags{std::move(flags)}
|
||||
{ }
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief Detected events all in one.
|
||||
@ -77,11 +77,11 @@ public:
|
||||
|
||||
explicit PollHandle(ConstructorAccess ca, std::shared_ptr<Loop> ref, int desc)
|
||||
: Handle{std::move(ca), std::move(ref)}, tag{FD}, fd{desc}
|
||||
{ }
|
||||
{}
|
||||
|
||||
explicit PollHandle(ConstructorAccess ca, std::shared_ptr<Loop> ref, OSSocketHandle sock)
|
||||
: Handle{std::move(ca), std::move(ref)}, tag{SOCKET}, socket{sock}
|
||||
{ }
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief Initializes the handle.
|
||||
|
||||
@ -19,7 +19,7 @@ namespace uvw {
|
||||
*
|
||||
* To create a `PrepareHandle` through a `Loop`, no arguments are required.
|
||||
*/
|
||||
struct PrepareEvent: Event<PrepareEvent> { };
|
||||
struct PrepareEvent: Event<PrepareEvent> {};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -45,7 +45,7 @@ enum class UVStdIOFlags: std::underlying_type_t<uv_stdio_flags> {
|
||||
*
|
||||
* It will be emitted by ProcessHandle according with its functionalities.
|
||||
*/
|
||||
struct ExitEvent: Event<ExitEvent> { };
|
||||
struct ExitEvent: Event<ExitEvent> {};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -18,7 +18,7 @@ namespace uvw {
|
||||
* It will be emitted by SignalHandle according with its functionalities.
|
||||
*/
|
||||
struct SignalEvent: Event<SignalEvent> {
|
||||
explicit SignalEvent(int sig) noexcept: signum{sig} { }
|
||||
explicit SignalEvent(int sig) noexcept: signum{sig} {}
|
||||
|
||||
int signum; /*!< The signal being monitored by this handle. */
|
||||
};
|
||||
|
||||
@ -21,7 +21,7 @@ namespace uvw {
|
||||
*
|
||||
* It will be emitted by StreamHandle according with its functionalities.
|
||||
*/
|
||||
struct ConnectEvent: Event<ConnectEvent> { };
|
||||
struct ConnectEvent: Event<ConnectEvent> {};
|
||||
|
||||
|
||||
/**
|
||||
@ -29,7 +29,7 @@ struct ConnectEvent: Event<ConnectEvent> { };
|
||||
*
|
||||
* It will be emitted by StreamHandle according with its functionalities.
|
||||
*/
|
||||
struct EndEvent: Event<EndEvent> { };
|
||||
struct EndEvent: Event<EndEvent> {};
|
||||
|
||||
|
||||
/**
|
||||
@ -37,7 +37,7 @@ struct EndEvent: Event<EndEvent> { };
|
||||
*
|
||||
* It will be emitted by StreamHandle according with its functionalities.
|
||||
*/
|
||||
struct ListenEvent: Event<ListenEvent> { };
|
||||
struct ListenEvent: Event<ListenEvent> {};
|
||||
|
||||
|
||||
/**
|
||||
@ -45,7 +45,7 @@ struct ListenEvent: Event<ListenEvent> { };
|
||||
*
|
||||
* It will be emitted by StreamHandle according with its functionalities.
|
||||
*/
|
||||
struct ShutdownEvent: Event<ShutdownEvent> { };
|
||||
struct ShutdownEvent: Event<ShutdownEvent> {};
|
||||
|
||||
|
||||
/**
|
||||
@ -53,7 +53,7 @@ struct ShutdownEvent: Event<ShutdownEvent> { };
|
||||
*
|
||||
* It will be emitted by StreamHandle according with its functionalities.
|
||||
*/
|
||||
struct WriteEvent: Event<WriteEvent> { };
|
||||
struct WriteEvent: Event<WriteEvent> {};
|
||||
|
||||
|
||||
/**
|
||||
@ -64,7 +64,7 @@ struct WriteEvent: Event<WriteEvent> { };
|
||||
struct DataEvent: Event<DataEvent> {
|
||||
explicit DataEvent(std::unique_ptr<char[]> data, std::size_t length) noexcept
|
||||
: data{std::move(data)}, length{length}
|
||||
{ }
|
||||
{}
|
||||
|
||||
std::unique_ptr<char[]> data; /*!< A bunch of data read on the stream. */
|
||||
std::size_t length; /*!< The amount of data read on the stream. */
|
||||
@ -101,7 +101,7 @@ public:
|
||||
: Request<WriteReq, uv_write_t>{std::move(ca), std::move(loop)},
|
||||
bufs{std::move(bufs)},
|
||||
nbufs{nbufs}
|
||||
{ }
|
||||
{}
|
||||
|
||||
void write(uv_stream_t *handle) {
|
||||
invoke(&uv_write, get(), handle, bufs.get(), nbufs, &defaultCallback<WriteEvent>);
|
||||
@ -158,7 +158,7 @@ public:
|
||||
#ifdef _WIN32
|
||||
StreamHandle(ConstructorAccess ca, std::shared_ptr<Loop> ref)
|
||||
: Handle{std::move(ca), std::move(ref)}
|
||||
{ }
|
||||
{}
|
||||
#else
|
||||
using Handle<T, U>::Handle;
|
||||
#endif
|
||||
|
||||
@ -54,7 +54,7 @@ public:
|
||||
|
||||
explicit TcpHandle(ConstructorAccess ca, std::shared_ptr<Loop> ref, unsigned int f)
|
||||
: StreamHandle{std::move(ca), std::move(ref)}, tag{FLAGS}, flags{f}
|
||||
{ }
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief Initializes the handle. No socket is created as of yet.
|
||||
|
||||
@ -32,7 +32,7 @@ class Thread final {
|
||||
|
||||
explicit Thread(std::shared_ptr<Loop> ref, InternalTask t, std::shared_ptr<void> d = nullptr) noexcept
|
||||
: pLoop{std::move(ref)}, data{std::move(d)}, thread{}, task{std::move(t)}
|
||||
{ }
|
||||
{}
|
||||
|
||||
public:
|
||||
using Task = InternalTask;
|
||||
@ -110,7 +110,7 @@ private:
|
||||
class Once final {
|
||||
explicit Once(std::shared_ptr<Loop> ref) noexcept
|
||||
: pLoop{std::move(ref)}
|
||||
{ }
|
||||
{}
|
||||
|
||||
static uv_once_t* guard() noexcept {
|
||||
static uv_once_t once = UV_ONCE_INIT;
|
||||
|
||||
@ -18,7 +18,7 @@ namespace uvw {
|
||||
*
|
||||
* It will be emitted by TimerHandle according with its functionalities.
|
||||
*/
|
||||
struct TimerEvent: Event<TimerEvent> { };
|
||||
struct TimerEvent: Event<TimerEvent> {};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -67,7 +67,7 @@ public:
|
||||
memo{resetModeMemo()},
|
||||
fd{desc},
|
||||
rw{readable}
|
||||
{ }
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief Initializes the handle.
|
||||
|
||||
@ -23,7 +23,7 @@ namespace uvw {
|
||||
*
|
||||
* It will be emitted by UDPHandle according with its functionalities.
|
||||
*/
|
||||
struct SendEvent: Event<SendEvent> { };
|
||||
struct SendEvent: Event<SendEvent> {};
|
||||
|
||||
|
||||
/**
|
||||
@ -34,7 +34,7 @@ struct SendEvent: Event<SendEvent> { };
|
||||
struct UDPDataEvent: Event<UDPDataEvent> {
|
||||
explicit UDPDataEvent(Addr sender, std::unique_ptr<const char[]> data, std::size_t length, bool partial) noexcept
|
||||
: data{std::move(data)}, length{length}, sender{std::move(sender)}, partial{partial}
|
||||
{ }
|
||||
{}
|
||||
|
||||
std::unique_ptr<const char[]> data; /*!< A bunch of data read on the stream. */
|
||||
std::size_t length; /*!< The amount of data read on the stream. */
|
||||
@ -66,7 +66,7 @@ public:
|
||||
: Request<SendReq, uv_udp_send_t>{std::move(ca), std::move(loop)},
|
||||
bufs{std::move(bufs)},
|
||||
nbufs{nbufs}
|
||||
{ }
|
||||
{}
|
||||
|
||||
void send(uv_udp_t *handle, const struct sockaddr* addr) {
|
||||
invoke(&uv_udp_send, get(), handle, bufs.get(), nbufs, addr, &defaultCallback<SendEvent>);
|
||||
@ -130,7 +130,7 @@ public:
|
||||
|
||||
explicit UDPHandle(ConstructorAccess ca, std::shared_ptr<Loop> ref, unsigned int f)
|
||||
: Handle{std::move(ca), std::move(ref)}, tag{FLAGS}, flags{f}
|
||||
{ }
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief Initializes the handle. The actual socket is created lazily.
|
||||
|
||||
@ -52,7 +52,7 @@ template<typename T>
|
||||
struct UVTypeWrapper {
|
||||
using Type = T;
|
||||
|
||||
constexpr UVTypeWrapper(Type val): value{val} { }
|
||||
constexpr UVTypeWrapper(Type val): value{val} {}
|
||||
constexpr operator Type() const noexcept { return value; }
|
||||
|
||||
private:
|
||||
@ -86,19 +86,19 @@ public:
|
||||
* @brief Constructs a Flags object from a value of the enum `E`.
|
||||
* @param flag An value of the enum `E`.
|
||||
*/
|
||||
constexpr Flags(E flag) noexcept: flags{toInnerType(flag)} { }
|
||||
constexpr Flags(E flag) noexcept: flags{toInnerType(flag)} {}
|
||||
|
||||
/**
|
||||
* @brief Constructs a Flags object from an instance of the underlying type
|
||||
* of the enum `E`.
|
||||
* @param f An instance of the underlying type of the enum `E`.
|
||||
*/
|
||||
constexpr Flags(Type f): flags{f} { }
|
||||
constexpr Flags(Type f): flags{f} {}
|
||||
|
||||
/**
|
||||
* @brief Constructs an uninitialized Flags object.
|
||||
*/
|
||||
constexpr Flags(): flags{} { }
|
||||
constexpr Flags(): flags{} {}
|
||||
|
||||
constexpr Flags(const Flags &f) noexcept: flags{f.flags} { }
|
||||
constexpr Flags(Flags &&f) noexcept: flags{std::move(f.flags)} { }
|
||||
@ -185,7 +185,7 @@ using RUsage = uv_rusage_t;
|
||||
|
||||
|
||||
struct Passwd {
|
||||
Passwd(std::shared_ptr<uv_passwd_t> passwd): passwd{passwd} { }
|
||||
Passwd(std::shared_ptr<uv_passwd_t> passwd): passwd{passwd} {}
|
||||
|
||||
std::string username() const noexcept { return passwd->username; }
|
||||
Uid uid() const noexcept { return passwd->uid; }
|
||||
@ -203,7 +203,7 @@ private:
|
||||
*
|
||||
* To be used as template parameter to switch between IPv4 and IPv6.
|
||||
*/
|
||||
struct IPv4 { };
|
||||
struct IPv4 {};
|
||||
|
||||
|
||||
/**
|
||||
@ -211,7 +211,7 @@ struct IPv4 { };
|
||||
*
|
||||
* To be used as template parameter to switch between IPv4 and IPv6.
|
||||
*/
|
||||
struct IPv6 { };
|
||||
struct IPv6 {};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -18,7 +18,7 @@ namespace uvw {
|
||||
*
|
||||
* It will be emitted by WorkReq according with its functionalities.
|
||||
*/
|
||||
struct WorkEvent: Event<WorkEvent> { };
|
||||
struct WorkEvent: Event<WorkEvent> {};
|
||||
|
||||
|
||||
/**
|
||||
@ -47,7 +47,7 @@ public:
|
||||
|
||||
explicit WorkReq(ConstructorAccess ca, std::shared_ptr<Loop> ref, InternalTask t)
|
||||
: Request{std::move(ca), std::move(ref)}, task{t}
|
||||
{ }
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief Runs the given task in a separate thread.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user