#include <cpp-terminal/terminfo.hpp>
|
enum class | ColorMode : std::uint8_t {
Unset
, NoColor
, Bit3
, Bit4
,
Bit8
, Bit24
} |
|
enum class | Bool : std::uint8_t { UTF8 = 0
, Legacy
, ControlSequences
} |
|
enum class | String : std::uint8_t { TermEnv
, TermName
, TermVersion
} |
|
enum class | Integer : std::uint8_t |
|
using | Booleans = std::array<bool, BoolNumber> |
|
using | Strings = std::array<std::string, StringNumber> |
|
using | Integers = std::array<std::uint32_t, IntegerNumber> |
|
Definition at line 19 of file terminfo.hpp.
◆ Booleans
◆ Integers
◆ Strings
◆ Bool
Enumerator |
---|
UTF8 | terminal has UTF-8 activated.
|
Legacy | Terminal is in legacy mode (Windows only).
|
ControlSequences | Terminal support control sequences.
|
Definition at line 38 of file terminfo.hpp.
39 {
43 };
@ Legacy
Terminal is in legacy mode (Windows only).
@ ControlSequences
Terminal support control sequences.
@ UTF8
terminal has UTF-8 activated.
◆ ColorMode
Enumerator |
---|
Unset | |
NoColor | |
Bit3 | |
Bit4 | |
Bit8 | |
Bit24 | |
Definition at line 24 of file terminfo.hpp.
25 {
27
29
31
33
35
37 };
◆ Integer
◆ String
Enumerator |
---|
TermEnv | TERM environment variable value.
|
TermName | Name of the terminal program if available.
|
TermVersion | Terminal version.
|
Definition at line 44 of file terminfo.hpp.
45 {
49 };
@ TermName
Name of the terminal program if available.
@ TermVersion
Terminal version.
@ TermEnv
TERM environment variable value.
◆ Terminfo()
Term::Terminfo::Terminfo |
( |
| ) |
|
◆ check()
void Term::Terminfo::check |
( |
| ) |
|
|
staticprivate |
Definition at line 120 of file terminfo.cpp.
121{
122 static bool checked{false};
123 if(!checked)
124 {
132 checked = true;
133 }
134}
static void checkTerminalName()
static void checkControlSequences()
static void checkLegacy()
static void checkColorMode()
static void checkTermEnv()
static void checkTerminalVersion()
◆ checkColorMode()
void Term::Terminfo::checkColorMode |
( |
| ) |
|
|
staticprivate |
Definition at line 144 of file terminfo.cpp.
145{
153#if defined(_WIN32)
156#endif
160}
static ColorMode m_colorMode
static Booleans m_booleans
std::pair< bool, std::string > getenv(const std::string &env)
Value of an environment variables.
bool WindowsVersionGreater(const DWORD &major, const DWORD &minor, const DWORD &patch)
◆ checkControlSequences()
void Term::Terminfo::checkControlSequences |
( |
| ) |
|
|
staticprivate |
Definition at line 162 of file terminfo.cpp.
163{
164#ifdef _WIN32
167#else
169#endif
170}
static void set(const Term::Terminfo::Bool &key, const bool &value)
◆ checkLegacy()
void Term::Terminfo::checkLegacy |
( |
| ) |
|
|
staticprivate |
Definition at line 84 of file terminfo.cpp.
85{
86#if defined(_WIN32)
87 #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
88 #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
89 #endif
91 else
92 {
93 DWORD dwOriginalOutMode{0};
94 GetConsoleMode(
Private::out.handle(), &dwOriginalOutMode);
96 else
97 {
98 SetConsoleMode(
Private::out.handle(), dwOriginalOutMode);
100 }
101 }
102#else
104#endif
105}
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING
◆ checkTermEnv()
void Term::Terminfo::checkTermEnv |
( |
| ) |
|
|
staticprivate |
◆ checkTerminalName()
void Term::Terminfo::checkTerminalName |
( |
| ) |
|
|
staticprivate |
Definition at line 109 of file terminfo.cpp.
110{
111 std::string name;
113 if(name.empty()) { name =
Private::getenv(
"TERMINAL_EMULATOR").second; }
116}
◆ checkTerminalVersion()
void Term::Terminfo::checkTerminalVersion |
( |
| ) |
|
|
staticprivate |
◆ checkUTF8()
void Term::Terminfo::checkUTF8 |
( |
| ) |
|
|
staticprivate |
Definition at line 172 of file terminfo.cpp.
173{
174#if defined(_WIN32)
176#else
181 std::size_t moved{cursor_after.
column() - cursor_before.column()};
185#endif
186}
std::size_t column() const
std::size_t write(const std::string &str) const
Term::Cursor cursor_position()
◆ get() [1/3]
◆ get() [2/3]
Definition at line 36 of file terminfo.cpp.
37{
39 return m_integers[
static_cast<std::size_t
>(key)];
40}
static Integers m_integers
◆ get() [3/3]
◆ getColorMode()
◆ set() [1/3]
◆ set() [2/3]
◆ set() [3/3]
◆ BoolNumber
const constexpr std::size_t Term::Terminfo::BoolNumber {3} |
|
staticconstexprprivate |
◆ IntegerNumber
const constexpr std::size_t Term::Terminfo::IntegerNumber {0} |
|
staticconstexprprivate |
◆ m_booleans
◆ m_colorMode
◆ m_integers
◆ m_strings
◆ StringNumber
const constexpr std::size_t Term::Terminfo::StringNumber {3} |
|
staticconstexprprivate |
The documentation for this class was generated from the following files: