|
Uni20
Asynchronous tensor and runtime library.
|
Classes | |
| struct | RGBColor |
| class | TerminalStyle |
| struct | toggle |
| A simple yes/no toggle that parses from a string. More... | |
Typedefs | |
| using | BGColor = std::variant< BackgroundColor, RGBColor > |
| using | FGColor = std::variant< ForegroundColor, RGBColor > |
Enumerations | |
| enum class | BackgroundColor { Default = 49 , Black = 40 , Red = 41 , Green = 42 , Yellow = 43 , Blue = 44 , Magenta = 45 , Cyan = 46 , LightGray = 47 , DarkGray = 100 , LightRed = 101 , LightGreen = 102 , LightYellow = 103 , LightBlue = 104 , LightMagenta = 105 , LightCyan = 106 , White = 107 } |
| enum class | ColorAttribute : unsigned { None = 0 , Bold = 1 << 0 , Dim = 1 << 1 , Underline = 1 << 2 } |
| enum class | ForegroundColor { Default = 39 , Black = 30 , Red = 31 , Green = 32 , Yellow = 33 , Blue = 34 , Magenta = 35 , Cyan = 36 , LightGray = 37 , DarkGray = 90 , LightRed = 91 , LightGreen = 92 , LightYellow = 93 , LightBlue = 94 , LightMagenta = 95 , LightCyan = 96 , White = 97 } |
Functions | |
| std::string | cmdline (int argc, char **argv) |
| std::string | color_if (std::string_view s, bool b, const TerminalStyle &ts) |
| std::string | color_text (std::string_view s, const TerminalStyle &ts) |
| int | columns () |
| Return the output terminal column count. | |
| int | columns (std::FILE *stream) |
| Return the terminal column count associated with a C stream. | |
| bool | env_exists (std::string const &str) |
| std::string | expand_environment (std::string const &s) |
| template<typename T , typename U > | |
| T | getenv_or_default (const std::string &var, const U &default_value) |
| char const * | getenv_or_default (std::string const &str, char const *Default) |
| bool | is_a_terminal (std::FILE *stream) |
| Test whether a C output stream refers to a terminal. | |
| bool | no_color_requested () |
Return whether NO_COLOR requests suppressing default ANSI color output. | |
| constexpr ColorAttribute | operator| (ColorAttribute lhs, ColorAttribute rhs) |
| constexpr ColorAttribute & | operator|= (ColorAttribute &lhs, ColorAttribute rhs) |
| std::optional< BackgroundColor > | parseBackgroundColor (const std::string &token) |
| std::optional< ColorAttribute > | parseColorAttribute (const std::string &token) |
| std::optional< ForegroundColor > | parseForegroundColor (const std::string &token) |
| std::optional< RGBColor > | parseHexColor (const std::string &token) |
| std::optional< RGBColor > | parseRGBColor (const std::string &token) |
| TerminalStyle | parseTerminalStyle (const std::string &styleStr) |
| std::string | quote_shell (std::string_view s) |
| int | rows () |
| Return the output terminal row count. | |
| int | rows (std::FILE *stream) |
| Return the terminal row count associated with a C stream. | |
| std::pair< int, int > | size () |
Return the output terminal size as (rows, columns). | |
| std::pair< int, int > | size (std::FILE *stream) |
| Return the terminal size associated with a C stream. | |
| std::vector< std::string > | split_string (const std::string &s, char delimiter) |
| std::vector< std::string > | splitString (const std::string &s, char delim) |
| std::vector< std::string > | splitTopLevel (const std::string &s, char delim=',') |
| std::string | to_lower (std::string s) |
| std::string | trim (const std::string &s) |
| using terminal::BGColor = typedef std::variant<BackgroundColor, RGBColor> |
| using terminal::FGColor = typedef std::variant<ForegroundColor, RGBColor> |
|
strong |
|
strong |
|
strong |
|
inline |
|
inline |
|
inline |
| int terminal::columns | ( | ) |
Return the output terminal column count.
COLUMNS, the detected terminal width, or UNI20_FALLBACK_TERMINAL_WIDTH. | int terminal::columns | ( | std::FILE * | stream | ) |
Return the terminal column count associated with a C stream.
| stream | Stream whose file descriptor should be queried. |
COLUMNS, the detected terminal width, or UNI20_FALLBACK_TERMINAL_WIDTH.
|
inline |
| std::string terminal::expand_environment | ( | std::string const & | s | ) |
| T terminal::getenv_or_default | ( | const std::string & | var, |
| const U & | default_value | ||
| ) |
|
inline |
| bool terminal::is_a_terminal | ( | std::FILE * | stream | ) |
Test whether a C output stream refers to a terminal.
| stream | Stream to inspect; a null stream is not a terminal. |
|
inline |
Return whether NO_COLOR requests suppressing default ANSI color output.
NO_COLOR is present and not empty.
|
constexpr |
|
constexpr |
| std::optional< BackgroundColor > terminal::parseBackgroundColor | ( | const std::string & | token | ) |
| std::optional< ColorAttribute > terminal::parseColorAttribute | ( | const std::string & | token | ) |
| std::optional< ForegroundColor > terminal::parseForegroundColor | ( | const std::string & | token | ) |
| std::optional< RGBColor > terminal::parseHexColor | ( | const std::string & | token | ) |
| std::optional< RGBColor > terminal::parseRGBColor | ( | const std::string & | token | ) |
| TerminalStyle terminal::parseTerminalStyle | ( | const std::string & | styleStr | ) |
|
inline |
| int terminal::rows | ( | ) |
Return the output terminal row count.
LINES, the detected terminal height, or the built-in row fallback. | int terminal::rows | ( | std::FILE * | stream | ) |
Return the terminal row count associated with a C stream.
| stream | Stream whose file descriptor should be queried. |
LINES, the detected terminal height, or the built-in row fallback. | std::pair< int, int > terminal::size | ( | ) |
Return the output terminal size as (rows, columns).
| std::pair< int, int > terminal::size | ( | std::FILE * | stream | ) |
Return the terminal size associated with a C stream.
| stream | Stream whose file descriptor should be queried. |
| std::vector< std::string > terminal::split_string | ( | const std::string & | s, |
| char | delimiter | ||
| ) |
| std::vector< std::string > terminal::splitString | ( | const std::string & | s, |
| char | delim | ||
| ) |
| std::vector< std::string > terminal::splitTopLevel | ( | const std::string & | s, |
| char | delim = ',' |
||
| ) |
|
inline |
|
inline |