Function guessHandle

Summary

#include <src/uvw/util.h>

(1) static HandleType guessHandle(HandleCategory category) noexcept

(2) static HandleType guessHandle(FileHandle file) noexcept

Function overload

Synopsis

#include <src/uvw/util.h>

static HandleType guessHandle(HandleCategory category) noexcept

Description

Gets the type of the handle given a category.

Parameters

category - A properly initialized handle category.

Returns
The actual type of the handle as defined by HandleType

Source

Lines 143-182 in src/uvw/util.cpp. Line 626 in src/uvw/util.h.

UVW_INLINE HandleType Utilities::guessHandle(HandleCategory category) noexcept {
    switch(category) {
    case UV_ASYNC:
        return HandleType::ASYNC;
    case UV_CHECK:
        return HandleType::CHECK;
    case UV_FS_EVENT:
        return HandleType::FS_EVENT;
    case UV_FS_POLL:
        return HandleType::FS_POLL;
    case UV_HANDLE:
        return HandleType::HANDLE;
    case UV_IDLE:
        return HandleType::IDLE;
    case UV_NAMED_PIPE:
        return HandleType::PIPE;
    case UV_POLL:
        return HandleType::POLL;
    case UV_PREPARE:
        return HandleType::PREPARE;
    case UV_PROCESS:
        return HandleType::PROCESS;
    case UV_STREAM:
        return HandleType::STREAM;
    case UV_TCP:
        return HandleType::TCP;
    case UV_TIMER:
        return HandleType::TIMER;
    case UV_TTY:
        return HandleType::TTY;
    case UV_UDP:
        return HandleType::UDP;
    case UV_SIGNAL:
        return HandleType::SIGNAL;
    case UV_FILE:
        return HandleType::FILE;
    default:
        return HandleType::UNKNOWN;
    }
}

Synopsis

#include <src/uvw/util.h>

static HandleType guessHandle(FileHandle file) noexcept

Description

Gets the type of the stream to be used with the given descriptor.

Returns the type of stream that should be used with a given file descriptor.
Usually this will be used during initialization to guess the type of the stdio streams.

Parameters

file - A valid descriptor.

Returns
One of the following types:

Source

Lines 185-188 in src/uvw/util.cpp. Line 646 in src/uvw/util.h.

UVW_INLINE HandleType Utilities::guessHandle(FileHandle file) noexcept {
    HandleCategory category = uv_guess_handle(file);
    return guessHandle(category);
}





Add Discussion as Guest

Log in