uvco 0.1
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
uvco::UvHandleDeleter Struct Reference

#include <internal_utils.h>

Public Member Functions

template<typename Handle >
void operator() (Handle *handle)
 

Static Public Member Functions

static void del (uv_handle_t *handle)
 

Detailed Description

A polymorphic functor for deleting a uv_handle_t. It dispatches to the correct uv_... function based on the handle's type. This is necessary for classes like StreamBase which contain a pointer to a uv_handle_t, but don't know the exact type of the handle.

Member Function Documentation

◆ del()

void uvco::UvHandleDeleter::del ( uv_handle_t *  handle)
static
31 {
32 switch (handle->type) {
33 case UV_TCP:
34 delete (uv_tcp_t *)handle;
35 break;
36 case UV_NAMED_PIPE:
37 delete (uv_pipe_t *)handle;
38 break;
39 case UV_TTY:
40 delete (uv_tty_t *)handle;
41 break;
42 default:
43 fmt::print("WARN: unhandled handle type {}\n", (int)handle->type);
44 delete handle;
45 }
46}

◆ operator()()

template<typename Handle >
void uvco::UvHandleDeleter::operator() ( Handle *  handle)
inline
80 {
81 del((uv_handle_t *)handle);
82 }
static void del(uv_handle_t *handle)
Definition internal_utils.cc:31

The documentation for this struct was generated from the following files: