nngn
|
Handles interactions with the output terminal. More...
Public Types | |
using | Flag = nngn::Input::TerminalFlag |
Public Member Functions | |
Terminal (int fd) | |
Creates an object for a given TTY. More... | |
~Terminal (void) | |
auto | size () const |
Size of the terminal in characters. More... | |
auto | pixel_size () const |
Size of the terminal in pixels. More... | |
bool | init () |
std::tuple< bool, bool > | update_size () |
Asks the OS for the terminal size. More... | |
bool | write (std::size_t n, const char *p) const |
Outputs the entire contents of a buffer. More... | |
template<typename T > | |
bool | write (const T &v) const |
Outputs the entire contents of a container. More... | |
bool | flush () |
Synchronizes the output file descriptor. More... | |
Terminal (Terminal &&rhs) | |
Terminal (int fd_, Flag flags_) | |
~Terminal (void) | |
Terminal & | operator= (Terminal &&rhs) |
bool | init (void) |
bool | read (char *c) const |
Private Attributes | |
int | fd |
OS file descriptor. More... | |
std::FILE * | f = {} |
fopen ed version of fd. More... | |
nngn::uvec2 | m_size = {} |
nngn::uvec2 | pixel = {} |
Flag | flags |
termios | t0 = {} |
termios | t = {} |
Handles interactions with the output terminal.
using anonymous_namespace{terminal.cpp}::Terminal::Flag = nngn::Input::TerminalFlag |
anonymous_namespace{terminal.cpp}::Terminal::Terminal | ( | int | fd | ) |
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. |
anonymous_namespace{terminal.cpp}::Terminal::~Terminal | ( | void | ) |
anonymous_namespace{terminal.cpp}::Terminal::Terminal | ( | Terminal && | rhs | ) |
anonymous_namespace{terminal.cpp}::Terminal::~Terminal | ( | void | ) |
bool anonymous_namespace{terminal.cpp}::Terminal::flush | ( | ) |
Synchronizes the output file descriptor.
bool anonymous_namespace{terminal.cpp}::Terminal::init | ( | void | ) |
bool anonymous_namespace{terminal.cpp}::Terminal::init | ( | void | ) |
|
inline |
Size of the terminal in pixels.
bool anonymous_namespace{terminal.cpp}::Terminal::read | ( | char * | c | ) | const |
|
inline |
Size of the terminal in characters.
std::tuple< bool, bool > anonymous_namespace{terminal.cpp}::Terminal::update_size | ( | void | ) |
Asks the OS for the terminal size.
Returns {changed, ok}.
|
inline |
Outputs the entire contents of a container.
bool anonymous_namespace{terminal.cpp}::Terminal::write | ( | std::size_t | n, |
const char * | p | ||
) | const |
Outputs the entire contents of a buffer.
|
private |
fopen
ed version of fd.
|
private |
OS file descriptor.
|
private |
|
private |
|
private |
|
private |
|
private |