cpp-terminal 1.0.0
Small C++ library for writing multiplatform terminal applications
Loading...
Searching...
No Matches
options.hpp
Go to the documentation of this file.
1/*
2* cpp-terminal
3* C++ library for writing multi-platform terminal applications.
4*
5* SPDX-FileCopyrightText: 2019-2024 cpp-terminal
6*
7* SPDX-License-Identifier: MIT
8*/
9
10#pragma once
11
12#include <cstdint>
13#include <initializer_list>
14#include <vector>
15
16namespace Term
17{
18
22enum class Option : std::int16_t
23{
24 Raw = 1,
25 Cooked = -1,
26 ClearScreen = 2,
27 NoClearScreen = -2,
28 SignalKeys = 3,
29 NoSignalKeys = -3,
30 Cursor = 4,
31 NoCursor = -4
32};
33
35{
36public:
37 Options() = default;
38 Options(const std::initializer_list<Term::Option>& option);
39 template<typename... Args> explicit Options(const Args&&... args) : m_Options(std::initializer_list<Term::Option>{args...}) { clean(); }
40
41 bool operator==(const Options& options);
42 bool operator!=(const Options& options);
43 bool has(const Option& option) const noexcept;
44
45private:
46 void clean();
47 std::vector<Term::Option> m_Options;
48};
49
50} // namespace Term
Options(const Args &&... args)
Definition options.hpp:39
Options()=default
bool has(const Option &option) const noexcept
Definition options.cpp:35
void clean()
Definition options.cpp:19
std::vector< Term::Option > m_Options
Definition options.hpp:47
bool operator==(const Options &options)
Definition options.cpp:16
bool operator!=(const Options &options)
Definition options.cpp:17
Definition args.cpp:13
Option
Option to set-up the terminal.
Definition options.hpp:23
@ NoClearScreen
Doesn't clear the screen.
@ ClearScreen
Clear the screen (and restore its states when the program stops).
@ Cooked
Set terminal in cooked mode.
@ Raw
Set terminal in raw mode.
@ NoSignalKeys
Disable the signal keys (Ctrl+C, etc...) will not be processed by the OS and will appears has standar...
@ NoCursor
Hide the cursor (and restore its states when the program stops).
@ SignalKeys
Enable the signal keys (Ctrl+C, etc...), if activated these keys will have their default OS behaviour...