nngn
|
Handles interactions with the output terminal. More...
#include <terminal.h>
Public Member Functions | |
Terminal (int fd) | |
Creates an object for a given TTY. | |
~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 (void) |
std::tuple< bool, bool > | update_size (void) |
Asks the OS for the terminal size. | |
bool | write (std::size_t n, const char *p) const |
Outputs the entire contents of a buffer. | |
template<typename T > | |
bool | write (const T &v) const |
Outputs the entire contents of a container. | |
bool | flush (void) const |
Synchronizes the output file descriptor. | |
bool | drain (void) const |
Private Attributes | |
int | fd = -1 |
OS file descriptor. | |
int | tty_fd = -1 |
std::FILE * | f = nullptr |
fopen ed version of fd. | |
uvec2 | m_size = {} |
uvec2 | pixel = {} |
Handles interactions with the output terminal.
|
inline |
Creates an object for a given TTY.
fd | OS file descriptor, whose lifetime is not managed and must remain valid until the object is destructed. |
nngn::term::Terminal::~Terminal | ( | void | ) |
bool nngn::term::Terminal::drain | ( | void | ) | const |
bool nngn::term::Terminal::flush | ( | void | ) | const |
Synchronizes the output file descriptor.
bool nngn::term::Terminal::init | ( | void | ) |
|
inline |
Size of the terminal in pixels.
|
inline |
Size of the terminal in characters.
Asks the OS for the terminal size.
Returns {changed, ok}.
Outputs the entire contents of a container.
Outputs the entire contents of a buffer.
|
private |
fopen
ed version of fd.
|
private |
OS file descriptor.
|
private |
|
private |
|
private |