uvw
2.10.0
|
#include <tty.h>
Public Member Functions | |
bool | init () |
Initializes the handle. More... | |
bool | mode (Mode m) |
Sets the TTY using the specified terminal mode. More... | |
bool | reset () noexcept |
Resets TTY settings to default values. More... | |
WinSize | getWinSize () |
Gets the current Window size. More... | |
void | vtermState (VTermState s) const noexcept |
Controls whether console virtual terminal sequences are processed by the library or console. More... | |
VTermState | vtermState () const noexcept |
Gets the current state of whether console virtual terminal sequences are handled by the library or the console. More... | |
![]() | |
void | shutdown () |
Shutdowns the outgoing (write) side of a duplex stream. More... | |
void | listen (int backlog=DEFAULT_BACKLOG) |
Starts listening for incoming connections. More... | |
void | accept (S &ref) |
Accepts incoming connections. More... | |
void | read () |
Starts reading data from an incoming stream. More... | |
void | stop () |
Stops reading data from the stream. More... | |
void | write (std::unique_ptr< char[], Deleter > data, unsigned int len) |
Writes data to the stream. More... | |
void | write (char *data, unsigned int len) |
Writes data to the stream. More... | |
void | write (S &send, std::unique_ptr< char[], Deleter > data, unsigned int len) |
Extended write function for sending handles over a pipe handle. More... | |
void | write (S &send, char *data, unsigned int len) |
Extended write function for sending handles over a pipe handle. More... | |
int | tryWrite (std::unique_ptr< char[]> data, unsigned int len) |
Queues a write request if it can be completed immediately. More... | |
int | tryWrite (std::unique_ptr< char[]> data, unsigned int len, StreamHandle< V, W > &send) |
Queues a write request if it can be completed immediately. More... | |
int | tryWrite (char *data, unsigned int len) |
Queues a write request if it can be completed immediately. More... | |
int | tryWrite (char *data, unsigned int len, StreamHandle< V, W > &send) |
Queues a write request if it can be completed immediately. More... | |
bool | readable () const noexcept |
Checks if the stream is readable. More... | |
bool | writable () const noexcept |
Checks if the stream is writable. More... | |
bool | blocking (bool enable=false) |
Enables or disables blocking mode for a stream. More... | |
size_t | writeQueueSize () const noexcept |
Gets the amount of queued bytes waiting to be sent. More... | |
![]() | |
HandleCategory | category () const noexcept |
Gets the category of the handle. More... | |
HandleType | type () const noexcept |
Gets the type of the handle. More... | |
bool | active () const noexcept |
Checks if the handle is active. More... | |
bool | closing () const noexcept |
Checks if a handle is closing or closed. More... | |
void | close () noexcept |
Request handle to be closed. More... | |
void | reference () noexcept |
Reference the given handle. More... | |
void | unreference () noexcept |
Unreference the given handle. More... | |
bool | referenced () const noexcept |
Checks if the given handle referenced. More... | |
std::size_t | size () const noexcept |
Returns the size of the underlying handle type. More... | |
int | sendBufferSize () |
Gets the size of the send buffer used for the socket. More... | |
bool | sendBufferSize (int value) |
Sets the size of the send buffer used for the socket. More... | |
int | recvBufferSize () |
Gets the size of the receive buffer used for the socket. More... | |
bool | recvBufferSize (int value) |
Sets the size of the receive buffer used for the socket. More... | |
OSFileDescriptor | fd () const |
Gets the platform dependent file descriptor equivalent. More... | |
![]() | |
template<typename R = void> | |
std::shared_ptr< R > | data () const |
Gets user-defined data. uvw won't use this field in any case. More... | |
void | data (std::shared_ptr< void > uData) |
Sets arbitrary data. uvw won't use this field in any case. More... | |
![]() | |
Loop & | loop () const noexcept |
Gets the loop from which the resource was originated. More... | |
const U * | raw () const noexcept |
Gets the underlying raw data structure. More... | |
U * | raw () noexcept |
Gets the underlying raw data structure. More... | |
![]() | |
template<typename E > | |
Connection< E > | on (Listener< E > f) |
Registers a long-lived listener with the event emitter. More... | |
template<typename E > | |
Connection< E > | once (Listener< E > f) |
Registers a short-lived listener with the event emitter. More... | |
template<typename E > | |
void | erase (Connection< E > conn) noexcept |
Disconnects a listener from the event emitter. More... | |
template<typename E > | |
void | clear () noexcept |
Disconnects all the listeners for the given event type. | |
void | clear () noexcept |
Disconnects all the listeners. | |
template<typename E > | |
bool | empty () const noexcept |
Checks if there are listeners registered for the specific event. More... | |
bool | empty () const noexcept |
Checks if there are listeners registered with the event emitter. More... | |
Additional Inherited Members | |
![]() | |
template<typename... Args> | |
static std::shared_ptr< T > | create (Args &&... args) |
Creates a new resource of the given type. More... | |
The TTYHandle handle.
TTY handles represent a stream for the console.
To create a TTYHandle
through a Loop
, arguments follow:
uvw::StdIN
or 0
for stdin
uvw::StdOUT
or 1
for stdout
uvw::StdERR
or 2
for stderr
read()
with this stream. Remember that stdin
is readable, stdout
is not.See the official documentation for further details.
WinSize uvw::TTYHandle::getWinSize | ( | ) |
Gets the current Window size.
{-1, -1}
in case of errors. bool uvw::TTYHandle::init | ( | ) |
Initializes the handle.
bool uvw::TTYHandle::mode | ( | Mode | m | ) |
Sets the TTY using the specified terminal mode.
Available modes are:
TTY::Mode::NORMAL
TTY::Mode::RAW
TTY::Mode::IO
See the official documentation for further details.
m | The mode to be set. |
|
noexcept |
Resets TTY settings to default values.
|
noexcept |
Gets the current state of whether console virtual terminal sequences are handled by the library or the console.
This function is not implemented on Unix.
Available states are:
TTY::VTermState::SUPPORTED
TTY::VTermState::UNSUPPORTED
See the official documentation for further details.
|
noexcept |
Controls whether console virtual terminal sequences are processed by the library or console.
This function is only meaningful on Windows systems. On Unix it is silently ignored.
Available states are:
TTY::VTermState::SUPPORTED
TTY::VTermState::UNSUPPORTED
See the official documentation for further details.
s | The state to be set. |