|
libcommonc++
0.7
|
A class that provides basic control of the console, such as changing text attributes, clearing the screen, and moving the cursor. More...
#include <Console.h++>
Public Types | |
| enum | TextColor { ColorBlack, ColorRed, ColorGreen, ColorYellow, ColorBlue, ColorMagenta, ColorCyan, ColorWhite } |
| Text colors. More... | |
| enum | TextStyle { StyleBold, StyleUnderline, StyleInverse } |
| Text styles. More... | |
Public Member Functions | |
| Console () | |
| Construct a new Console object. More... | |
| ~Console () | |
| Destructor. More... | |
| size_t | read (char *text, size_t maxlen) |
| Read text from the console. More... | |
| void | write (const char *text, size_t len=0) |
| Write text to the console. More... | |
| bool | setEcho (bool on) |
| Enable or disable the echoing of input characters on the console. More... | |
| void | moveCursor (uint_t row, uint_t column) |
| Move the cursor to a new position. More... | |
| void | clear () |
| Clear the console. More... | |
| void | setTextForeground (TextColor color) |
| Set the foreground color for subsequent text. More... | |
| void | setTextBackground (TextColor color) |
| Set the background color for subsequent text. More... | |
| void | beginTextStyle (TextStyle style) |
| Turn on a text style for subsequent text. More... | |
| void | endTextStyle (TextStyle style) |
| Turn off a text style for subsequent text. More... | |
| void | resetTextStyle () |
| Turn off all text styles for subsequent text. More... | |
| void | setTitle (const String &title) |
| Set the title of the console window. More... | |
| bool | getSize (uint_t *columns, uint_t *rows) |
| Get the size of the console, in rows and columns. More... | |
A class that provides basic control of the console, such as changing text attributes, clearing the screen, and moving the cursor.
| enum TextColor |
| enum TextStyle |
| ~Console | ( | ) |
Destructor.
| void beginTextStyle | ( | TextStyle | style | ) |
Turn on a text style for subsequent text.
| style | The style to turn on. |
| void clear | ( | ) |
Clear the console.
| void endTextStyle | ( | TextStyle | style | ) |
Turn off a text style for subsequent text.
| style | The style to turn off. |
Get the size of the console, in rows and columns.
| columns | A pointer to the value in which to store the number of columns. May be NULL. |
| rows | A pointer to the value in which to store the number of rows. May be NULL. |
Move the cursor to a new position.
If the specified position is not valid, the cursor is not moved.
| row | The new row. |
| column | The new column. |
| size_t read | ( | char * | text, |
| size_t | maxlen | ||
| ) |
Read text from the console.
| text | The array of characters to read into. The array will always be NUL-terminated on return. |
| maxlen | The maximum number of characters to read. |
| void resetTextStyle | ( | ) |
Turn off all text styles for subsequent text.
| bool setEcho | ( | bool | on | ) |
Enable or disable the echoing of input characters on the console.
| void setTextBackground | ( | TextColor | color | ) |
Set the background color for subsequent text.
| color | The text color. |
| void setTextForeground | ( | TextColor | color | ) |
Set the foreground color for subsequent text.
| color | The text color. |
| void setTitle | ( | const String & | title | ) |
Set the title of the console window.
| title | The new title. |
| void write | ( | const char * | text, |
| size_t | len = 0 |
||
| ) |
Write text to the console.
| text | The array of characters to write. |
| len | The number of characters to write, or 0 to write all characters in the array, up to a NUL. |