nngn
anonymous_namespace{terminal.cpp}::Terminal Struct Reference

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)
 
Terminaloperator= (Terminal &&rhs)
 
bool init (void)
 
bool read (char *c) const
 

Private Attributes

int fd
 OS file descriptor. More...
 
std::FILE * f = {}
 fopened version of fd. More...
 
nngn::uvec2 m_size = {}
 
nngn::uvec2 pixel = {}
 
Flag flags
 
termios t0 = {}
 
termios t = {}
 

Detailed Description

Handles interactions with the output terminal.

Member Typedef Documentation

◆ Flag

using anonymous_namespace{terminal.cpp}::Terminal::Flag = nngn::Input::TerminalFlag

Constructor & Destructor Documentation

◆ Terminal() [1/3]

anonymous_namespace{terminal.cpp}::Terminal::Terminal ( int  fd)

Creates an object for a given TTY.

Parameters
fdOS file descriptor, whose lifetime is not managed and must remain valid until the object is destructed.

◆ ~Terminal() [1/2]

anonymous_namespace{terminal.cpp}::Terminal::~Terminal ( void  )
Here is the call graph for this function:

◆ Terminal() [2/3]

anonymous_namespace{terminal.cpp}::Terminal::Terminal ( Terminal &&  rhs)

◆ Terminal() [3/3]

anonymous_namespace{terminal.cpp}::Terminal::Terminal ( int  fd_,
Flag  flags_ 
)
inline

◆ ~Terminal() [2/2]

anonymous_namespace{terminal.cpp}::Terminal::~Terminal ( void  )

Member Function Documentation

◆ flush()

bool anonymous_namespace{terminal.cpp}::Terminal::flush ( )

Synchronizes the output file descriptor.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init() [1/2]

bool anonymous_namespace{terminal.cpp}::Terminal::init ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init() [2/2]

bool anonymous_namespace{terminal.cpp}::Terminal::init ( void  )

◆ operator=()

Terminal& anonymous_namespace{terminal.cpp}::Terminal::operator= ( Terminal &&  rhs)
inline

◆ pixel_size()

auto anonymous_namespace{terminal.cpp}::Terminal::pixel_size ( ) const
inline

Size of the terminal in pixels.

◆ read()

bool anonymous_namespace{terminal.cpp}::Terminal::read ( char *  c) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

auto anonymous_namespace{terminal.cpp}::Terminal::size ( void  ) const
inline

Size of the terminal in characters.

Here is the caller graph for this function:

◆ update_size()

std::tuple< bool, bool > anonymous_namespace{terminal.cpp}::Terminal::update_size ( void  )

Asks the OS for the terminal size.

Returns {changed, ok}.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write() [1/2]

template<typename T >
bool anonymous_namespace{terminal.cpp}::Terminal::write ( const T v) const
inline

Outputs the entire contents of a container.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write() [2/2]

bool anonymous_namespace{terminal.cpp}::Terminal::write ( std::size_t  n,
const char *  p 
) const

Outputs the entire contents of a buffer.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ f

std::FILE* anonymous_namespace{terminal.cpp}::Terminal::f = {}
private

fopened version of fd.

◆ fd

int anonymous_namespace{terminal.cpp}::Terminal::fd
private

OS file descriptor.

◆ flags

Flag anonymous_namespace{terminal.cpp}::Terminal::flags
private

◆ m_size

nngn::uvec2 anonymous_namespace{terminal.cpp}::Terminal::m_size = {}
private

◆ pixel

nngn::uvec2 anonymous_namespace{terminal.cpp}::Terminal::pixel = {}
private

◆ t

termios anonymous_namespace{terminal.cpp}::Terminal::t = {}
private

◆ t0

termios anonymous_namespace{terminal.cpp}::Terminal::t0 = {}
private

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