diff --git a/src/uvw/util.hpp b/src/uvw/util.hpp index 80d8fe60..4f206480 100644 --- a/src/uvw/util.hpp +++ b/src/uvw/util.hpp @@ -37,6 +37,18 @@ enum class UVHandleType: std::underlying_type_t { }; +template +struct UVTypeWrapper { + using Type = T; + + constexpr UVTypeWrapper(Type val): value{val} { } + constexpr operator Type() const noexcept { return value; } + +private: + const Type value; +}; + + } @@ -137,38 +149,6 @@ private: }; -/** - * @brief Wrapper for underlying library's types. - * - * In particular, It is used for: - * - * * `FileHandle` (that is an alias for `UVTypeWrapper`) - * * `OSSocketHandle` (that is an alias for `UVTypeWrapper`) - * * `OSFileDescriptor` (that is an alias for `UVTypeWrapper`) - * - * It can be bound to each value of type `T` and it will be implicitly converted - * to the underlying type when needed. - */ -template -struct UVTypeWrapper { - using Type = T; - - /** - * @brief Constructs a new instance of the wrapper. - * @param val The value to be stored. - */ - constexpr UVTypeWrapper(Type val): value{val} { } - - /** - * @brief Cast operator to the underlying type. - * @return The stored value. - */ - constexpr operator Type() const noexcept { return value; } -private: - const Type value; -}; - - /** * @brief Address representation. * @@ -196,9 +176,9 @@ struct WinSize { int width; int height; }; using HandleType = details::UVHandleType; -using FileHandle = UVTypeWrapper; -using OSSocketHandle = UVTypeWrapper; -using OSFileDescriptor = UVTypeWrapper; +using FileHandle = details::UVTypeWrapper; +using OSSocketHandle = details::UVTypeWrapper; +using OSFileDescriptor = details::UVTypeWrapper; using TimeSpec = uv_timespec_t; using Stat = uv_stat_t; @@ -268,4 +248,27 @@ HandleType guessHandle(FileHandle file) { } +/** + * TODO + * + * * uv_replace_allocator + * * uv_uptime + * * uv_getrusage + * * uv_cpu_info + * * uv_free_cpu_info + * * uv_interface_addresses + * * uv_free_interface_addresses + * * uv_loadavg + * * uv_exepath + * * uv_cwd + * * uv_chdir + * * uv_os_homedir + * * uv_os_tmpdir + * * uv_os_get_passwd + * * uv_os_free_passwd + * * uv_get_total_memory + * * uv_hrtime + */ + + }