uvw 2.12.1
Loading...
Searching...
No Matches
uvw::TTYHandle Class Referencefinal

The TTYHandle handle. More...

#include <tty.h>

Inheritance diagram for uvw::TTYHandle:
Collaboration diagram for uvw::TTYHandle:

Public Member Functions

bool init ()
 Initializes the handle.
 
bool mode (Mode m)
 Sets the TTY using the specified terminal mode.
 
bool reset () noexcept
 Resets TTY settings to default values.
 
WinSize getWinSize ()
 Gets the current Window size.
 
void vtermState (VTermState s) const noexcept
 Controls whether console virtual terminal sequences are processed by the library or console.
 
VTermState vtermState () const noexcept
 Gets the current state of whether console virtual terminal sequences are handled by the library or the console.
 
- Public Member Functions inherited from uvw::StreamHandle< TTYHandle, uv_tty_t >
void shutdown ()
 Shutdowns the outgoing (write) side of a duplex stream.
 
void listen (int backlog=DEFAULT_BACKLOG)
 Starts listening for incoming connections.
 
void accept (S &ref)
 Accepts incoming connections.
 
void read ()
 Starts reading data from an incoming stream.
 
void stop ()
 Stops reading data from the stream.
 
void write (std::unique_ptr< char[], Deleter > data, unsigned int len)
 Writes data to the stream.
 
void write (char *data, unsigned int len)
 Writes data to the stream.
 
void write (S &send, std::unique_ptr< char[], Deleter > data, unsigned int len)
 Extended write function for sending handles over a pipe handle.
 
void write (S &send, char *data, unsigned int len)
 Extended write function for sending handles over a pipe handle.
 
int tryWrite (std::unique_ptr< char[]> data, unsigned int len)
 Queues a write request if it can be completed immediately.
 
int tryWrite (std::unique_ptr< char[]> data, unsigned int len, StreamHandle< V, W > &send)
 Queues a write request if it can be completed immediately.
 
int tryWrite (char *data, unsigned int len)
 Queues a write request if it can be completed immediately.
 
int tryWrite (char *data, unsigned int len, StreamHandle< V, W > &send)
 Queues a write request if it can be completed immediately.
 
bool readable () const noexcept
 Checks if the stream is readable.
 
bool writable () const noexcept
 Checks if the stream is writable.
 
bool blocking (bool enable=false)
 Enables or disables blocking mode for a stream.
 
size_t writeQueueSize () const noexcept
 Gets the amount of queued bytes waiting to be sent.
 
- Public Member Functions inherited from uvw::Handle< TTYHandle, uv_tty_t >
HandleCategory category () const noexcept
 Gets the category of the handle.
 
HandleType type () const noexcept
 Gets the type of the handle.
 
bool active () const noexcept
 Checks if the handle is active.
 
bool closing () const noexcept
 Checks if a handle is closing or closed.
 
void close () noexcept
 Request handle to be closed.
 
void reference () noexcept
 Reference the given handle.
 
void unreference () noexcept
 Unreference the given handle.
 
bool referenced () const noexcept
 Checks if the given handle referenced.
 
std::size_t size () const noexcept
 Returns the size of the underlying handle type.
 
int sendBufferSize ()
 Gets the size of the send buffer used for the socket.
 
bool sendBufferSize (int value)
 Sets the size of the send buffer used for the socket.
 
int recvBufferSize ()
 Gets the size of the receive buffer used for the socket.
 
bool recvBufferSize (int value)
 Sets the size of the receive buffer used for the socket.
 
OSFileDescriptor fd () const
 Gets the platform dependent file descriptor equivalent.
 
- Public Member Functions inherited from uvw::Resource< TTYHandle, uv_tty_t >
std::shared_ptr< R > data () const
 Gets user-defined data. uvw won't use this field in any case.
 
void data (std::shared_ptr< void > uData)
 Sets arbitrary data. uvw won't use this field in any case.
 
- Public Member Functions inherited from uvw::UnderlyingType< TTYHandle, uv_tty_t >
Looploop () const noexcept
 Gets the loop from which the resource was originated.
 
const uv_tty_t * raw () const noexcept
 Gets the underlying raw data structure.
 
uv_tty_t * raw () noexcept
 Gets the underlying raw data structure.
 
- Public Member Functions inherited from uvw::Emitter< TTYHandle >
Connection< E > on (Listener< E > f)
 Registers a long-lived listener with the event emitter.
 
Connection< E > once (Listener< E > f)
 Registers a short-lived listener with the event emitter.
 
void erase (Connection< E > conn) noexcept
 Disconnects a listener from the event emitter.
 
void clear () noexcept
 Disconnects all the listeners for the given event type.
 
void clear () noexcept
 Disconnects all the listeners.
 
bool empty () const noexcept
 Checks if there are listeners registered for the specific event.
 
bool empty () const noexcept
 Checks if there are listeners registered with the event emitter.
 

Additional Inherited Members

- Public Types inherited from uvw::Emitter< TTYHandle >
- Static Public Member Functions inherited from uvw::UnderlyingType< TTYHandle, uv_tty_t >
static std::shared_ptr< TTYHandlecreate (Args &&...args)
 Creates a new resource of the given type.
 
- Protected Types inherited from uvw::Resource< TTYHandle, uv_tty_t >
- Protected Member Functions inherited from uvw::Handle< TTYHandle, uv_tty_t >
- Protected Member Functions inherited from uvw::Resource< TTYHandle, uv_tty_t >
- Protected Member Functions inherited from uvw::UnderlyingType< TTYHandle, uv_tty_t >
- Protected Member Functions inherited from uvw::Emitter< TTYHandle >
- Static Protected Member Functions inherited from uvw::Handle< TTYHandle, uv_tty_t >

Detailed Description

The TTYHandle handle.

TTY handles represent a stream for the console.

To create a TTYHandle through a Loop, arguments follow:

  • A valid FileHandle. Usually the file descriptor will be:
  • A boolean value that specifies the plan on calling read() with this stream. Remember that stdin is readable, stdout is not.

See the official documentation for further details.

Definition at line 49 of file tty.h.

Member Function Documentation

◆ getWinSize()

WinSize uvw::TTYHandle::getWinSize ( )

Gets the current Window size.

Returns
The current Window size or {-1, -1} in case of errors.

◆ init()

bool uvw::TTYHandle::init ( )

Initializes the handle.

Returns
True in case of success, false otherwise.

◆ mode()

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.

Parameters
mThe mode to be set.
Returns
True in case of success, false otherwise.

◆ reset()

bool uvw::TTYHandle::reset ( )
noexcept

Resets TTY settings to default values.

Returns
True in case of success, false otherwise.

◆ vtermState() [1/2]

VTermState uvw::TTYHandle::vtermState ( ) const
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.

Returns
The current state.

◆ vtermState() [2/2]

void uvw::TTYHandle::vtermState ( VTermState s) const
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.

Parameters
sThe state to be set.

The documentation for this class was generated from the following file: