|
CPGen
C++ project generator
|
RAII raw-mode terminal handler. More...
#include <Terminal.hpp>
Public Member Functions | |
| Terminal () | |
| Enter raw mode and hide the cursor. | |
| ~Terminal () | |
| Restore the original terminal state and show the cursor. | |
| Terminal (const Terminal &)=delete | |
| Non-copyable. | |
| Terminal & | operator= (const Terminal &)=delete |
| Non-copyable. | |
| Terminal (Terminal &&)=delete | |
| Non-movable. | |
| Terminal & | operator= (Terminal &&)=delete |
| Non-movable. | |
RAII raw-mode terminal handler.
| Event | Action |
|---|---|
| Construction | Save termios, enable raw mode, hide cursor, install |
signal handlers. | | Destruction | Restore termios, show cursor. | | SIGINT/SIGTERM | Restore terminal, call std::_Exit(130). |
Terminal instance should be alive at a time; the signal handler uses a static copy of the original termios structure.The class is non-copyable and non-movable to prevent double-restore bugs.
|
inline |
Enter raw mode and hide the cursor.
On POSIX: reads the current termios, disables ICANON (line buffering) and ECHO, and applies the modified struct with TCSANOW. On all platforms: hides the cursor with ESC[?25l and installs signal handlers for SIGINT and SIGTERM.
|
inline |
Restore the original terminal state and show the cursor.
|
delete |
Non-copyable.
|
delete |
Non-movable.