|
CPPConsole
|
Namespace Containing all console commands. More...
Data Structures | |
| struct | ConsoleCoord |
| A position on the console (row and column) More... | |
| struct | Dimensions |
| A structure representing the dimensions of the console. More... | |
| struct | is_map |
| Template for a map-like data type. Matches things like map and unordered_map. More... | |
| struct | is_not_string |
| struct | iterable |
| Template for a iterable data type. Matches things like vector, deque, map, etc. More... | |
Enumerations | |
| enum | Graphics { BOLD = 1 , DIM , ITALIC , UNDERLINE , BLINK , INVERT , HIDDEN , STRIKETHROUGH , BLACK = 30 , RED , GREEN , YELLOW , BLUE , MAGENTA , CYAN , WHITE , DEFAULT = 39 , BG_BLACK = 40 , BG_RED , BG_GREEN , BG_YELLOW , BG_BLUE , BG_MAGENTA , BG_CYAN , BG_WHITE , BG_DEFAULT = 49 , BRIGHT_BLACK = 90 , BRIGHT_RED , BRIGHT_GREEN , BRIGHT_YELLOW , BRIGHT_BLUE , BRIGHT_MAGENTA , BRIGHT_CYAN , BRIGHT_WHITE , BG_BRIGHT_BLACK = 100 , BG_BRIGHT_RED , BG_BRIGHT_GREEN , BG_BRIGHT_YELLOW , BG_BRIGHT_BLUE , BG_BRIGHT_MAGENTA , BG_BRIGHT_CYAN , BG_BRIGHT_WHITE } |
| Enumeration of builtin colors for ANSI escape codes, along with other graphics modes. More... | |
Functions | |
| bool | isANSIEnabled () |
| Checks if ANSI Codes are enable in windows. | |
| void | enableANSI () |
| Enables ANSI for Windows environments. | |
| std::string | colorize (const std::string &str, Graphics color) |
| Colors the text color to a predefined color. | |
| std::string | colorize (const std::string &str, unsigned char color, bool foreground=true) |
| Colors the text color to a custom color, between 0 to 255. | |
| std::string | colorize (const std::string &str, unsigned char r, unsigned char g, unsigned char b, bool foreground=true) |
| Colors the text color to a custom RGB color. | |
| void | setColor (Graphics color) |
| Sets the color of the text to a predefined color. | |
| void | setColor (unsigned char color, bool foreground=true) |
| Sets the color of the text to a custom color, between 0 to 255. | |
| void | setColor (unsigned char r, unsigned char g, unsigned char b, bool foreground=true) |
| Sets the color of the text to a custom RGB color. | |
| template<typename T > | |
| void | print (const T &value) |
| Prints out a value. | |
| template<typename T , size_t N, typename std::enable_if_t< is_not_string< T >::value, int > = 0> | |
| void | print (const T(&arr)[N]) |
| Prints out the values of an array. | |
| template<size_t N> | |
| void | print (const char(&arr)[N]) |
| Prints out a char array. | |
| void | print (const std::string &str) |
| Prints out a string. | |
| void | print () |
| template<typename T > | |
| void | println (const T &value) |
| Prints out an object, then a newline. | |
| void | println () |
| Prints out a newline. | |
| ConsoleCoord | getCursorPosition () |
| Gets the position of the cursor within the console. | |
| void | moveCursorHome () |
| Moves cursor to home position (0, 0) | |
| void | moveCursorToPosition (int row, int col) |
| Move the cursor to the specified position in the console. | |
| void | moveCursorUp (int n) |
| Move the cursor up by n lines. | |
| void | moveCursorDown (int n) |
| Move the cursor down by n lines. | |
| void | moveCursorRight (int n) |
| Move the cursor right by n lines. | |
| void | moveCursorLeft (int n) |
| Move the cursor left by n lines. | |
| void | moveCursorDownAndToStart (int n) |
| Moves cursor to beginning of next line, n lines down. | |
| void | moveCursorUpAndToStart (int n) |
| Moves cursor to beginning of previous line, n lines up. | |
| void | moveCursorToColumn (int n) |
| Moves cursor to column n. | |
| Dimensions | getDimensions () |
| Gets the width and height of the console. | |
| void | eraseFromCursorToEOS () |
| Erases the screen from the cursor to the end of screen. | |
| void | eraseFromCursorToBOS () |
| Erases the screen from the cursor to the beginning of screen. | |
| void | eraseEntireScreen () |
| Erases the entire screen. | |
| void | eraseFromCursorToEOL () |
| Erases from the cursor position to the end of the line. | |
| void | eraseFromCursorToBOL () |
| Erases from the cursor position to the beginning of the line. | |
| void | eraseCurrentLine () |
| Erases the line the cursor is currently on. | |
| std::string | bold (const std::string &str) |
| Returns a bolded string if ANSI is enabled. | |
| std::string | faint (const std::string &str) |
| Returns a faint/dim string if ANSI is enabled. | |
| std::string | italic (const std::string &str) |
| Returns an italicized string if ANSI is enabled. | |
| std::string | underline (const std::string &str) |
| Returns an underlined string if ANSI is enabled. | |
| std::string | blink (const std::string &str) |
| Returns a blinking string if ANSI is enabled. | |
| std::string | inverse (const std::string &str) |
| Returns a inversed/reversed string if ANSI is enabled. | |
| std::string | hidden (const std::string &str) |
| Returns a hidden string if ANSI is enabled. | |
| std::string | strikethrough (const std::string &str) |
| Returns a strikethough string if ANSI is enabled. | |
| void | setBold (bool set) |
| Sets the text to be bold or not. | |
| void | setFaint (bool set) |
| Sets the text to be faint/dim or not. | |
| void | setItalic (bool set) |
| Sets the text to be italicized or not. | |
| void | setUnderline (bool set) |
| Sets the text to be underlined or not. | |
| void | setBlink (bool set) |
| Sets the text to be blinking or not. | |
| void | setInverse (bool set) |
| Sets the text to be inversed/reversed or not. | |
| void | setHidden (bool set) |
| Sets the text to be hidden or not. | |
| void | setStrikethrough (bool set) |
| Sets the text to be strikethrough or not. | |
| void | set (std::initializer_list< Graphics > list) |
| std::string | set (const std::string &str, std::initializer_list< Graphics > list) |
| void | clearGraphics () |
| template<typename T > | |
| void | printAll (T t) |
| template<typename T , typename... Args> | |
| void | printAll (T t, Args... args) |
| Prints all items, with a space inbetween. | |
| template<typename T > | |
| void | printlnAll (T t) |
| template<typename T , typename... Args> | |
| void | printlnAll (T t, Args... args) |
| Prints all items. | |
Namespace Containing all console commands.
| enum Graphics |
Enumeration of builtin colors for ANSI escape codes, along with other graphics modes.
| std::string blink | ( | const std::string & | str | ) |
Returns a blinking string if ANSI is enabled.
| std::string bold | ( | const std::string & | str | ) |
Returns a bolded string if ANSI is enabled.
| void clearGraphics | ( | ) |
| std::string colorize | ( | const std::string & | str, |
| Graphics | color | ||
| ) |
Colors the text color to a predefined color.
| color | The color to set the text to |
| std::string colorize | ( | const std::string & | str, |
| unsigned char | color, | ||
| bool | foreground = true |
||
| ) |
Colors the text color to a custom color, between 0 to 255.
From 0 to 15, the colors are the standard ANSI colors From 16 to 231, the color uses the forumla 16 + (R × 36) + (G × 6) + B From 232 to 255, the colors are grayscale
| color | Color to set the text to |
| foreground | Whether to set the foreground or background color (default is foreground) |
| std::string colorize | ( | const std::string & | str, |
| unsigned char | r, | ||
| unsigned char | g, | ||
| unsigned char | b, | ||
| bool | foreground = true |
||
| ) |
Colors the text color to a custom RGB color.
| str | The string to colorize |
| r | Red value (0-255) |
| g | Green value (0-255) |
| b | Blue value (0-255) |
| foreground | Whether to set the foreground or background color (default is foreground) |
| void enableANSI | ( | ) |
Enables ANSI for Windows environments.
| void eraseCurrentLine | ( | ) |
Erases the line the cursor is currently on.
| void eraseEntireScreen | ( | ) |
Erases the entire screen.
| void eraseFromCursorToBOL | ( | ) |
Erases from the cursor position to the beginning of the line.
| void eraseFromCursorToBOS | ( | ) |
Erases the screen from the cursor to the beginning of screen.
| void eraseFromCursorToEOL | ( | ) |
Erases from the cursor position to the end of the line.
| void eraseFromCursorToEOS | ( | ) |
Erases the screen from the cursor to the end of screen.
| std::string faint | ( | const std::string & | str | ) |
Returns a faint/dim string if ANSI is enabled.
| ConsoleCoord getCursorPosition | ( | ) |
Gets the position of the cursor within the console.
| Dimensions getDimensions | ( | ) |
Gets the width and height of the console.
| std::string hidden | ( | const std::string & | str | ) |
Returns a hidden string if ANSI is enabled.
| std::string inverse | ( | const std::string & | str | ) |
Returns a inversed/reversed string if ANSI is enabled.
| bool isANSIEnabled | ( | ) |
Checks if ANSI Codes are enable in windows.
| std::string italic | ( | const std::string & | str | ) |
Returns an italicized string if ANSI is enabled.
| void moveCursorDown | ( | int | n | ) |
Move the cursor down by n lines.
| n | Number of lines to move by. |
| void moveCursorDownAndToStart | ( | int | n | ) |
Moves cursor to beginning of next line, n lines down.
| n | Number of lines to move by. |
| void moveCursorHome | ( | ) |
Moves cursor to home position (0, 0)
| void moveCursorLeft | ( | int | n | ) |
Move the cursor left by n lines.
| n | Number of lines to move by. |
| void moveCursorRight | ( | int | n | ) |
Move the cursor right by n lines.
| n | Number of lines to move by. |
| void moveCursorToColumn | ( | int | n | ) |
Moves cursor to column n.
| n | Column to move to |
| void moveCursorToPosition | ( | int | row, |
| int | col | ||
| ) |
Move the cursor to the specified position in the console.
| row | Row to move to |
| col | Column to move to |
| void moveCursorUp | ( | int | n | ) |
Move the cursor up by n lines.
| n | Number of lines to move by. |
| void moveCursorUpAndToStart | ( | int | n | ) |
Moves cursor to beginning of previous line, n lines up.
| n | Number of lines to move by. |
| void print | ( | ) |
| void print | ( | const char(&) | arr[N] | ) |
Prints out a char array.
| N | Size of array |
| arr | The array |
| void print | ( | const std::string & | str | ) |
Prints out a string.
| str | The string to print |
| void print | ( | const T & | value | ) |
Prints out a value.
| T | Type of the value |
| value | The item to print |
| void print | ( | const T(&) | arr[N] | ) |
Prints out the values of an array.
| T | Type of the array |
| N | Length of the array |
| arr | The array |
| void printAll | ( | T | t | ) |
| void printAll | ( | T | t, |
| Args... | args | ||
| ) |
Prints all items, with a space inbetween.
| args | Items to print |
| void println | ( | ) |
Prints out a newline.
| void println | ( | const T & | value | ) |
Prints out an object, then a newline.
| T | Type of the item passed in |
| value | Value to print |
| void printlnAll | ( | T | t | ) |
| void printlnAll | ( | T | t, |
| Args... | args | ||
| ) |
Prints all items.
| args | Items to print |
| std::string set | ( | const std::string & | str, |
| std::initializer_list< Graphics > | list | ||
| ) |
| void set | ( | std::initializer_list< Graphics > | list | ) |
| void setBlink | ( | bool | set | ) |
Sets the text to be blinking or not.
| set | Enable/Disable blinking text |
| void setBold | ( | bool | set | ) |
Sets the text to be bold or not.
| set | Enable/Disable bold text |
| void setColor | ( | Graphics | color | ) |
Sets the color of the text to a predefined color.
| color | The color to set the text to |
| void setColor | ( | unsigned char | color, |
| bool | foreground = true |
||
| ) |
Sets the color of the text to a custom color, between 0 to 255.
From 0 to 15, the colors are the standard ANSI colors From 16 to 231, the color uses the forumla 16 + (R × 36) + (G × 6) + B From 232 to 255, the colors are grayscale
| color | Color to set the text to |
| foreground | Whether to set the foreground or background color (default is foreground) |
| void setColor | ( | unsigned char | r, |
| unsigned char | g, | ||
| unsigned char | b, | ||
| bool | foreground = true |
||
| ) |
Sets the color of the text to a custom RGB color.
| color | The color to set the text to |
| foreground | Whether to set the foreground or background color (default is foreground) |
| void setFaint | ( | bool | set | ) |
Sets the text to be faint/dim or not.
| set | Enable/Disable faint/dim text |
| void setHidden | ( | bool | set | ) |
Sets the text to be hidden or not.
| set | Enable/Disable hidden text |
| void setInverse | ( | bool | set | ) |
Sets the text to be inversed/reversed or not.
| set | Enable/Disable inversed/reversed text |
| void setItalic | ( | bool | set | ) |
Sets the text to be italicized or not.
| set | Enable/Disable italicized text |
| void setStrikethrough | ( | bool | set | ) |
Sets the text to be strikethrough or not.
| set | Enable/Disable strikethrough text |
| void setUnderline | ( | bool | set | ) |
Sets the text to be underlined or not.
| set | Enable/Disable underlined text |
| std::string strikethrough | ( | const std::string & | str | ) |
Returns a strikethough string if ANSI is enabled.
| std::string underline | ( | const std::string & | str | ) |
Returns an underlined string if ANSI is enabled.