CPGen
C++ project generator
Loading...
Searching...
No Matches
Typedefs | Enumerations
Defs Namespace Reference

Core type definitions shared across all TUI components. More...

Typedefs

using Key = std::variant< char, Special >
 A single keypress from stdin, represented as either a printable character or a Special control key.
 

Enumerations

enum class  Special : std::uint8_t {
  Enter , Up , Down , Left ,
  Right , Escape , Backspace , Tab
}
 Non-printable / control keys recognised by the input reader. More...
 

Detailed Description

Core type definitions shared across all TUI components.

Typedef Documentation

◆ Key

A single keypress from stdin, represented as either a printable character or a Special control key.

Components receive a Key value from Utils::readKey() and pattern-match it with std::holds_alternative / std::get to implement their input logic.

Enumeration Type Documentation

◆ Special

enum class Defs::Special : std::uint8_t
strong

Non-printable / control keys recognised by the input reader.

The underlying type is std::uint8_t to keep the enum as compact as possible (see the performance-enum-size guideline).

Enumerator
Enter 

Return / Enter key (\r or \n).

Up 

Up arrow (ESC [ A).

Down 

Down arrow (ESC [ B).

Left 

Left arrow (ESC [ C).

Right 

Right arrow (ESC [ D).

Escape 

Escape key or unrecognised escape sequence.

Backspace 

Backspace (0x7F) or Delete (0x08).

Tab 

Horizontal tab (\t).