koutil
Loading...
Searching...
No Matches
koutil::term::terminal Class Reference

#include <terminal.h>

Public Types

enum class  Error {
  NONE , DOUBLE_INIT , CODEPAGE_FAIL , INPUT_HANDLE_ERR ,
  OUTPUT_HANDLE_ERR , SETUP
}
 

Public Member Functions

 ~terminal ()
 

Static Public Member Functions

static bool init ()
 Initializes the terminal.
 
static void register_signals ()
 Registers signal handlers for the terminal.
 
static void rollback ()
 Rolls back changes made to the terminal.
 
static ColorSupport color_support ()
 Retrieves the level of color support for the terminal.
 
static Error error ()
 Retrieves the current error state of the terminal.
 
static bool has_error ()
 Checks if the terminal has encountered an error.
 
static Dimensions query_dimensions ()
 Queries the dimensions of the terminal window.
 

Private Member Functions

 terminal ()=default
 
void exit ()
 

Static Private Member Functions

static void handle_exit_signal (int)
 

Private Attributes

std::stack< std::function< void()> > m_on_exit
 
Error m_error
 
bool m_has_signals = false
 
ColorSupport m_color_support = ColorSupport::COLOR16
 

Static Private Attributes

static std::unique_ptr< terminals_instance = nullptr
 

Member Enumeration Documentation

◆ Error

enum class koutil::term::terminal::Error
strong
Enumerator
NONE 

No error.

DOUBLE_INIT 

Double initialization error.

CODEPAGE_FAIL 

Failure to set code page error.

INPUT_HANDLE_ERR 

Error with input handle.

OUTPUT_HANDLE_ERR 

Error with output handle.

SETUP 

Terminal setup error.

Constructor & Destructor Documentation

◆ ~terminal()

koutil::term::terminal::~terminal ( )
inline

◆ terminal()

koutil::term::terminal::terminal ( )
privatedefault

Member Function Documentation

◆ color_support()

ColorSupport koutil::term::terminal::color_support ( )
static

Retrieves the level of color support for the terminal.

Returns
The color support level.

◆ error()

terminal::Error koutil::term::terminal::error ( )
static

Retrieves the current error state of the terminal.

Returns
The current error state.

◆ exit()

void koutil::term::terminal::exit ( )
inlineprivate

◆ handle_exit_signal()

static void koutil::term::terminal::handle_exit_signal ( int )
inlinestaticprivate

◆ has_error()

bool koutil::term::terminal::has_error ( )
static

Checks if the terminal has encountered an error.

Returns
True if there is an error, false otherwise.

◆ init()

bool koutil::term::terminal::init ( )
static

Initializes the terminal.

Returns
True if initialization succeeds, false otherwise.

◆ query_dimensions()

Dimensions koutil::term::terminal::query_dimensions ( )
static

Queries the dimensions of the terminal window.

Returns
The dimensions of the terminal window.

◆ register_signals()

void koutil::term::terminal::register_signals ( )
static

Registers signal handlers for the terminal.

◆ rollback()

void koutil::term::terminal::rollback ( )
static

Rolls back changes made to the terminal.

Member Data Documentation

◆ m_color_support

ColorSupport koutil::term::terminal::m_color_support = ColorSupport::COLOR16
private

◆ m_error

Error koutil::term::terminal::m_error
private

◆ m_has_signals

bool koutil::term::terminal::m_has_signals = false
private

◆ m_on_exit

std::stack<std::function<void()> > koutil::term::terminal::m_on_exit
private

◆ s_instance

std::unique_ptr< terminal > koutil::term::terminal::s_instance = nullptr
staticprivate

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