HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sysutil::Term Class Reference

#include <sysutil.h>

Public Member Functions

 Term () noexcept
 Default ctr: assume ANSI escape sequences are ok. More...
 
 Term (FILE *file)
 
 Term (const std::ostream &stream)
 
std::string ansi (string_view command) const
 
std::string ansi (string_view command, string_view text) const
 
std::string ansi_fgcolor (int r, int g, int b)
 Extended color control: take RGB values from 0-255. More...
 
std::string ansi_bgcolor (int r, int g, int b)
 
bool is_console () const noexcept
 

Detailed Description

Term object encapsulates information about terminal output for the sake of constructing ANSI escape sequences.

Definition at line 129 of file sysutil.h.

Constructor & Destructor Documentation

Sysutil::Term::Term ( )
inlinenoexcept

Default ctr: assume ANSI escape sequences are ok.

Definition at line 132 of file sysutil.h.

Sysutil::Term::Term ( FILE *  file)

Construct from a FILE*: ANSI codes ok if the file describes a live console, otherwise they will be supressed.

Sysutil::Term::Term ( const std::ostream &  stream)

Construct from a stream: ANSI codes ok if the file describes a live console, otherwise they will be supressed.

Member Function Documentation

std::string Sysutil::Term::ansi ( string_view  command) const

ansi("appearance") returns the ANSI escape sequence for the named command (if ANSI codes are ok, otherwise it will return the empty string). Accepted commands include: "default", "bold", "underscore", "blink", "reverse", "concealed", "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "black_bg", "red_bg", "green_bg", "yellow_bg", "blue_bg", "magenta_bg", "cyan_bg", "white_bg". Commands may be combined with "," for example: "bold,green,white_bg".

std::string Sysutil::Term::ansi ( string_view  command,
string_view  text 
) const
inline

ansi("appearance", "text") returns the text, with the formatting command, then the text, then the formatting command to return to default appearance.

Definition at line 153 of file sysutil.h.

std::string Sysutil::Term::ansi_bgcolor ( int  r,
int  g,
int  b 
)
std::string Sysutil::Term::ansi_fgcolor ( int  r,
int  g,
int  b 
)

Extended color control: take RGB values from 0-255.

bool Sysutil::Term::is_console ( ) const
inlinenoexcept

Definition at line 162 of file sysutil.h.


The documentation for this class was generated from the following file: