nngn
|
Handles interactions with the output terminal. More...
#include <terminal.h>
Public Member Functions | |
Terminal (void)=default | |
~Terminal (void) | |
auto | size (void) const |
Size of the terminal in characters. | |
auto | pixel_size (void) const |
Size of the terminal in pixels. | |
bool | init (int fd) |
Creates an object for a given TTY. | |
std::tuple< bool, bool > | update_size (void) |
Retrieves the terminal size from the operating system. | |
bool | write (std::size_t n, const char *p) const |
Outputs the entire contents of a buffer. | |
bool | write (const std::ranges::sized_range auto &v) const |
Outputs the entire contents of a range. | |
bool | flush (void) const |
bool | drain (void) const |
bool | show_cursor (void) const |
bool | hide_cursor (void) const |
Private Attributes | |
int | fd = -1 |
OS file descriptor. | |
FILE * | f = nullptr |
fdopen(3) ed version of fd. | |
int | tty_fd = -1 |
File descriptor for the controlling TTY. | |
uvec2 | m_size = {} |
Size of the terminal in characters. | |
uvec2 | m_pixel_size = {} |
Size of the terminal in screen pixels, if available. | |
Handles interactions with the output terminal.
|
default |
nngn::Terminal::~Terminal | ( | void | ) |
bool nngn::Terminal::drain | ( | void | ) | const |
bool nngn::Terminal::flush | ( | void | ) | const |
|
inline |
Creates an object for a given TTY.
fd | Output file descriptor, dup(2) ed internally. |
|
inline |
Size of the terminal in pixels.
|
inline |
|
inline |
Size of the terminal in characters.
Retrieves the terminal size from the operating system.
Outputs the entire contents of a range.
Outputs the entire contents of a buffer.
|
private |
fdopen(3)
ed version of fd.
|
private |
OS file descriptor.
|
private |
Size of the terminal in screen pixels, if available.
|
private |
Size of the terminal in characters.
|
private |
File descriptor for the controlling TTY.
Different from fd
if !isatty(fd)
.