EMath++
Classes for mathematical concepts
Loading...
Searching...
No Matches
efc::Terminal Class Reference

Terminal class to manage the terminal through curses. More...

Public Member Functions

void flush ()
 Function for flushin all the Terminal's Windows.
 
void set_ltitle (const ::std::string title) noexcept
 Function for setting the title of the left Window.
 
void set_rtitle (const ::std::string title) noexcept
 Function for setting the title of the right Window.
 
void set_prompt (const ::std::string prompt) noexcept
 Function for setting the prompt of the bottom Window.
 
void set_ldata (::std::vector<::std::string > data) noexcept
 Function for setting data vector of the left Window.
 
void set_rdata (::std::vector<::std::string > data) noexcept
 Function for setting data vector of the right Window.
 
const int get_short_input () const
 Function for getting short single char input from the Terminal.
 
const ::std::string get_long_input () const
 Function for getting long single string input from the Terminal.
 
void scroll_down (const unsigned int id) noexcept
 Function for scrolling down the left or right window depending on the provided id.
 
void scroll_up (const unsigned int id) noexcept
 Function for scrolling up the left or right window depending on the provided id.
 
void echo_result (const ::std::string &result)
 Echoes the provided result to the prompt and waits for a key press.
 
void swap_active (const unsigned int id) noexcept
 Swaps the active window to the one matching the provide id.
 
 ~Terminal () noexcept
 Default destructor, it deletes the Window pointers, sets the singleton instance to nullptr, stops the signal listener and stops curses.
 

Static Public Member Functions

static Terminalinit () noexcept
 Static function for building the singleton static instance.
 

Detailed Description

Terminal class to manage the terminal through curses.

It works as a singleton. Not generic in any way.

Definition at line 259 of file interface.cpp.

Constructor & Destructor Documentation

◆ ~Terminal()

efc::Terminal::~Terminal ( )
inlinenoexcept

Default destructor, it deletes the Window pointers, sets the singleton instance to nullptr, stops the signal listener and stops curses.

Definition at line 438 of file interface.cpp.

Member Function Documentation

◆ echo_result()

void efc::Terminal::echo_result ( const ::std::string &  result)
inline

Echoes the provided result to the prompt and waits for a key press.

Parameters
resultThe result to echo as a const ::std::string&

Definition at line 416 of file interface.cpp.

References efc::Window::get_title(), and efc::Window::o.

◆ flush()

void efc::Terminal::flush ( )
inline

Function for flushin all the Terminal's Windows.

Definition at line 347 of file interface.cpp.

References efc::Window::o.

◆ get_long_input()

const ::std::string efc::Terminal::get_long_input ( ) const
inline

Function for getting long single string input from the Terminal.

Returns
(::std::string) The input as a std::string

Definition at line 391 of file interface.cpp.

References efc::Window::o.

◆ get_short_input()

const int efc::Terminal::get_short_input ( ) const
inline

Function for getting short single char input from the Terminal.

Returns
(const int) Int representing the pressed key

Definition at line 377 of file interface.cpp.

References efc::Window::o.

◆ init()

static Terminal * efc::Terminal::init ( )
inlinestaticnoexcept

Static function for building the singleton static instance.

Returns
(Terminal*) The singleton instance pointer also stored at Terminal::instance

Definition at line 340 of file interface.cpp.

◆ scroll_down()

void efc::Terminal::scroll_down ( const unsigned int  id)
inlinenoexcept

Function for scrolling down the left or right window depending on the provided id.

Parameters
idThe id of the window as a const unsigned int

Definition at line 396 of file interface.cpp.

References efc::OWindow::scroll_down().

◆ scroll_up()

void efc::Terminal::scroll_up ( const unsigned int  id)
inlinenoexcept

Function for scrolling up the left or right window depending on the provided id.

Parameters
idThe id of the window as a const unsigned int

Definition at line 406 of file interface.cpp.

References efc::OWindow::scroll_up().

◆ set_ldata()

void efc::Terminal::set_ldata ( ::std::vector<::std::string >  data)
inlinenoexcept

Function for setting data vector of the left Window.

Parameters
dataThe data as a std::vector of std::string

Definition at line 367 of file interface.cpp.

References efc::OWindow::set_data().

◆ set_ltitle()

void efc::Terminal::set_ltitle ( const ::std::string  title)
inlinenoexcept

Function for setting the title of the left Window.

Parameters
titleThe title as a std::string

Definition at line 352 of file interface.cpp.

References efc::Window::set_title().

◆ set_prompt()

void efc::Terminal::set_prompt ( const ::std::string  prompt)
inlinenoexcept

Function for setting the prompt of the bottom Window.

Parameters
promptThe prompt as a std::string

Definition at line 362 of file interface.cpp.

References efc::Window::set_title().

◆ set_rdata()

void efc::Terminal::set_rdata ( ::std::vector<::std::string >  data)
inlinenoexcept

Function for setting data vector of the right Window.

Parameters
dataThe data as a std::vector of std::string

Definition at line 372 of file interface.cpp.

References efc::OWindow::set_data().

◆ set_rtitle()

void efc::Terminal::set_rtitle ( const ::std::string  title)
inlinenoexcept

Function for setting the title of the right Window.

Parameters
titleThe title as a std::string

Definition at line 357 of file interface.cpp.

References efc::Window::set_title().

◆ swap_active()

void efc::Terminal::swap_active ( const unsigned int  id)
inlinenoexcept

Swaps the active window to the one matching the provide id.

Parameters
idThe id of the window as a const unsigned int

Definition at line 427 of file interface.cpp.


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