koutil
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Concepts
koutil::term Namespace Reference

Namespaces

namespace  color
 
namespace  color_literals
 

Classes

struct  Color
 Structure representing a color. More...
 
struct  ColorBG
 Structure representing a background color. More...
 
struct  ColorFG
 Structure representing a foreground color. More...
 
struct  CursorMove
 Represents a cursor movement command. More...
 
struct  CursorPos
 Represents a cursor movement command. More...
 
struct  Dimensions
 Represents the dimensions of the terminal buffer. More...
 
class  terminal
 

Enumerations

enum class  CursorCommand {
  MOVE_HOME , SAVE , RESTORE , HIDE ,
  SHOW
}
 Enumerates different cursor commands. More...
 
enum class  BufferCommand : char { ENABLE_ALTERNATIVE_BUFFER = 'h' , DISABLE_ALTERNATIVE_BUFFER = 'l' }
 Enumerates different buffer commands. More...
 
enum class  EraseCommand {
  ERASE_CURSOR_END , ERASE_CURSOR_BEGIN , ERASE_SCREEN , ERASE_LINE ,
  ERASE_LINE_CURSOR_END , ERASE_LINE_CURSOR_BEGIN
}
 Enumerates different erase commands. More...
 
enum class  Style : std::uint8_t {
  NONE = 0 , BOLD = 1 << 0 , DIM = 1 << 1 , ITALIC = 1 << 2 ,
  UNDERLINE = 1 << 3 , BLINK = 1 << 4 , INVERSE = 1 << 5 , HIDDEN = 1 << 6 ,
  STRIKETHOUGH = 1 << 7
}
 
enum class  ColorSupport { COLOR16 , COLOR256 , TRUE_COLOR }
 Enumerates the levels of color support for the terminal. More...
 

Functions

std::ostream & operator<< (std::ostream &stream, ColorBG bg)
 
std::ostream & operator<< (std::ostream &stream, ColorFG fg)
 
std::ostream & reset_bg (std::ostream &stream)
 Resets background color to default.
 
std::ostream & reset_fg (std::ostream &stream)
 Resets foreground color to default.
 
std::ostream & reset_color (std::ostream &stream)
 Resets foreground and background color to default.
 
std::ostream & operator<< (std::ostream &stream, CursorPos pos)
 
std::ostream & operator<< (std::ostream &stream, CursorMove move)
 
std::ostream & operator<< (std::ostream &stream, CursorCommand cmd)
 
std::ostream & operator<< (std::ostream &stream, BufferCommand cmd)
 
std::ostream & operator<< (std::ostream &stream, EraseCommand cmd)
 
constexpr Style operator+ (Style a, Style b)
 
constexpr Style operator- (Style a, Style b)
 
constexpr Style operator& (Style a, Style b)
 
constexpr bool style_contains (Style style, Style flags)
 Checks if a text style contains certain flags.
 
std::ostream & operator<< (std::ostream &stream, Style style)
 
std::ostream & reset_all (std::ostream &stream)
 Resets all text styles and colors to default.
 

Enumeration Type Documentation

◆ BufferCommand

enum class koutil::term::BufferCommand : char
strong

Enumerates different buffer commands.

Enumerator
ENABLE_ALTERNATIVE_BUFFER 

Enable the alternative buffer.

DISABLE_ALTERNATIVE_BUFFER 

Disable the alternative buffer.

◆ ColorSupport

enum class koutil::term::ColorSupport
strong

Enumerates the levels of color support for the terminal.

Enumerator
COLOR16 
COLOR256 
TRUE_COLOR 

◆ CursorCommand

enum class koutil::term::CursorCommand
strong

Enumerates different cursor commands.

Enumerator
MOVE_HOME 

Move the cursor to the home position.

SAVE 

Save the current cursor position.

RESTORE 

Restore the saved cursor position.

HIDE 

Hide the cursor.

SHOW 

Show the cursor.

◆ EraseCommand

enum class koutil::term::EraseCommand
strong

Enumerates different erase commands.

Enumerator
ERASE_CURSOR_END 

Erase from the cursor to the end of the screen.

ERASE_CURSOR_BEGIN 

Erase from the cursor to the beginning of the screen.

ERASE_SCREEN 

Erase the entire screen.

ERASE_LINE 

Erase the current line.

ERASE_LINE_CURSOR_END 

Erase from the cursor to the end of the line.

ERASE_LINE_CURSOR_BEGIN 

Erase from the cursor to the beginning of the line.

◆ Style

enum class koutil::term::Style : std::uint8_t
strong
Enumerator
NONE 

No style.

BOLD 

Bold text.

DIM 

Dim text.

ITALIC 

Italic text.

UNDERLINE 

Underlined text.

BLINK 

Blinking text.

INVERSE 

Inverted colors for text.

HIDDEN 

Hidden text.

STRIKETHOUGH 

Text with a strikethrough effect.

Function Documentation

◆ operator&()

Style koutil::term::operator& ( Style a,
Style b )
constexpr

◆ operator+()

Style koutil::term::operator+ ( Style a,
Style b )
constexpr

◆ operator-()

Style koutil::term::operator- ( Style a,
Style b )
constexpr

◆ operator<<() [1/8]

std::ostream & koutil::term::operator<< ( std::ostream & stream,
BufferCommand cmd )

◆ operator<<() [2/8]

std::ostream & koutil::term::operator<< ( std::ostream & stream,
ColorBG bg )

◆ operator<<() [3/8]

std::ostream & koutil::term::operator<< ( std::ostream & stream,
ColorFG fg )

◆ operator<<() [4/8]

std::ostream & koutil::term::operator<< ( std::ostream & stream,
CursorCommand cmd )

◆ operator<<() [5/8]

std::ostream & koutil::term::operator<< ( std::ostream & stream,
CursorMove move )

◆ operator<<() [6/8]

std::ostream & koutil::term::operator<< ( std::ostream & stream,
CursorPos pos )

◆ operator<<() [7/8]

std::ostream & koutil::term::operator<< ( std::ostream & stream,
EraseCommand cmd )

◆ operator<<() [8/8]

std::ostream & koutil::term::operator<< ( std::ostream & stream,
Style style )

◆ reset_all()

std::ostream & koutil::term::reset_all ( std::ostream & stream)

Resets all text styles and colors to default.

Parameters
streamThe output stream.
Returns
The modified output stream.

◆ reset_bg()

std::ostream & koutil::term::reset_bg ( std::ostream & stream)

Resets background color to default.

Parameters
streamThe output stream.
Returns
The modified output stream.

◆ reset_color()

std::ostream & koutil::term::reset_color ( std::ostream & stream)

Resets foreground and background color to default.

Parameters
streamThe output stream.
Returns
The modified output stream.

◆ reset_fg()

std::ostream & koutil::term::reset_fg ( std::ostream & stream)

Resets foreground color to default.

Parameters
streamThe output stream.
Returns
The modified output stream.

◆ style_contains()

bool koutil::term::style_contains ( Style style,
Style flags )
constexpr

Checks if a text style contains certain flags.

Parameters
styleThe text style to check.
flagsThe flags to check for.
Returns
True if the text style contains all specified flags, false otherwise.