cpp-terminal 1.0.0
Small C++ library for writing multiplatform terminal applications
Loading...
Searching...
No Matches
Term::TerminalInitializer Class Reference

#include <cpp-terminal/terminal_initializer.hpp>

Public Member Functions

 ~TerminalInitializer () noexcept
 
 TerminalInitializer () noexcept
 
 TerminalInitializer (const TerminalInitializer &)=delete
 
 TerminalInitializer (TerminalInitializer &&)=delete
 
TerminalInitializeroperator= (TerminalInitializer &&)=delete
 
TerminalInitializeroperator= (const TerminalInitializer &)=delete
 

Static Private Attributes

static std::size_t m_counter {0}
 

Detailed Description

Definition at line 17 of file terminal_initializer.hpp.

Constructor & Destructor Documentation

◆ ~TerminalInitializer()

Term::TerminalInitializer::~TerminalInitializer ( )
noexcept

Definition at line 40 of file terminal_initializer.cpp.

42{
43 --m_counter;
44 if(0 == m_counter) { (&Term::terminal)->~Terminal(); }
45}
46catch(...)
47{
49}
void ExceptionHandler(const ExceptionDestination &destination=ExceptionDestination::StdErr) noexcept
Term::Terminal & terminal
Definition terminal.cpp:19

◆ TerminalInitializer() [1/3]

Term::TerminalInitializer::TerminalInitializer ( )
noexcept

Definition at line 21 of file terminal_initializer.cpp.

23{
24 if(0 == m_counter)
25 {
26 static const Private::FileInitializer files_init;
27 static std::vector<sighandler_t> m_handlers;
28 new(&Term::terminal) Terminal();
29 static Term::Private::Signals signals(m_handlers);
30 sighandler_t handler = [](int signum) { Term::Private::Signals::reset_and_raise(signum, m_handlers, Term::terminal); };
31 signals.setHandler(handler);
32 }
33 ++m_counter;
34}
35catch(...)
36{
38}
static void reset_and_raise(int sign, std::vector< sighandler_t > &m_han, Term::Terminal &) noexcept
Definition signals.cpp:64
void(*)(int) sighandler_t
Definition signals.hpp:14

◆ TerminalInitializer() [2/3]

Term::TerminalInitializer::TerminalInitializer ( const TerminalInitializer & )
delete

◆ TerminalInitializer() [3/3]

Term::TerminalInitializer::TerminalInitializer ( TerminalInitializer && )
delete

Member Function Documentation

◆ operator=() [1/2]

TerminalInitializer & Term::TerminalInitializer::operator= ( const TerminalInitializer & )
delete

◆ operator=() [2/2]

TerminalInitializer & Term::TerminalInitializer::operator= ( TerminalInitializer && )
delete

Member Data Documentation

◆ m_counter

std::size_t Term::TerminalInitializer::m_counter {0}
staticprivate

Definition at line 19 of file terminal_initializer.hpp.

19:
20 ~TerminalInitializer() noexcept;
21 TerminalInitializer() noexcept;
24 TerminalInitializer& operator=(TerminalInitializer&&) = delete;
25 TerminalInitializer& operator=(const TerminalInitializer&) = delete;
26
27private:
28 static std::size_t m_counter;
29};
30
31} // namespace Term
32

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