12 #pragma warning(disable : 4668)
33 return m_booleans[
static_cast<std::size_t
>(key)];
39 return m_integers[
static_cast<std::size_t
>(key)];
45 return m_strings[
static_cast<std::size_t
>(key)];
57 #pragma warning(disable : 4191)
59 #pragma GCC diagnostic push
60 #pragma GCC diagnostic ignored "-Wcast-function-type"
62 NTSTATUS(WINAPI * getVersion)
63 (PRTL_OSVERSIONINFOW) = (
reinterpret_cast<NTSTATUS(WINAPI*)(PRTL_OSVERSIONINFOW)
>(GetProcAddress(GetModuleHandle(TEXT(
"ntdll.dll")),
"RtlGetVersion")));
67 #pragma GCC diagnostic pop
69 if(getVersion !=
nullptr)
71 RTL_OSVERSIONINFOW rovi;
72 rovi.dwOSVersionInfoSize =
sizeof(rovi);
73 if(getVersion(&rovi) == 0)
75 if(rovi.dwMajorVersion > major || (rovi.dwMajorVersion == major && (rovi.dwMinorVersion > minor || (rovi.dwMinorVersion == minor && rovi.dwBuildNumber >= patch))))
return true;
87 #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
88 #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
93 DWORD dwOriginalOutMode{0};
94 GetConsoleMode(
Private::out.handle(), &dwOriginalOutMode);
98 SetConsoleMode(
Private::out.handle(), dwOriginalOutMode);
113 if(name.empty()) { name =
Private::getenv(
"TERMINAL_EMULATOR").second; }
122 static bool checked{
false};
127 checkTerminalVersion();
128 checkControlSequences();
181 std::size_t moved{cursor_after.
column() - cursor_before.column()};
std::size_t column() const
std::size_t write(const std::string &str) const
static bool get(const Term::Terminfo::Bool &key)
static void checkTerminalName()
static void checkControlSequences()
static void checkLegacy()
static ColorMode getColorMode()
@ Legacy
Terminal is in legacy mode (Windows only).
@ ControlSequences
Terminal support control sequences.
@ UTF8
terminal has UTF-8 activated.
static void checkColorMode()
static void set(const Term::Terminfo::Bool &key, const bool &value)
static void checkTermEnv()
std::array< bool, BoolNumber > Booleans
std::array< std::uint32_t, IntegerNumber > Integers
static ColorMode m_colorMode
static Integers m_integers
@ TermName
Name of the terminal program if available.
@ TermVersion
Terminal version.
@ TermEnv
TERM environment variable value.
static Booleans m_booleans
std::array< std::string, StringNumber > Strings
static void checkTerminalVersion()
std::pair< bool, std::string > getenv(const std::string &env)
Value of an environment variables.
Term::Cursor cursor_position()
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING
bool WindowsVersionGreater(const DWORD &major, const DWORD &minor, const DWORD &patch)