xtd - Reference Guide
0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
|
#include <console.h>
Represents the standard input, output, and error streams for console applications.
Inherits xtd::static_object.
Static Public Attributes | |
static event< console, console_cancel_event_handler > | cancel_key_press |
Occurs when the Control modifier key (Ctrl) and either the ConsoleKey.C console key (C) or the Break key are pressed simultaneously (Ctrl+C or Ctrl+Break). | |
static std::ostream | error |
Gets the error output stream. A std::basic_ostream<char_t> that represents the error output stream. | |
static std::istream | in |
Gets the standard input stream. A std::basic_istream<char_t> that represents the standard input stream. | |
static std::ostream | out |
Gets the standard output stream. A std::basic_ostream<char_t> that represents the standard output stream. | |
Static Public Member Functions | |
static console_color | background_color () |
Gets the background color of the console. | |
static void | background_color (console_color color) |
Sets the background color of the console. | |
static void | beep () |
Plays the sound of a beep through the console speaker. | |
static void | beep (uint32_t frequency, uint32_t duration) |
Plays the sound of a beep of a specified frequency and duration through the console speaker. | |
static int32_t | buffer_height () |
Gets the height of the buffer area. | |
static void | buffer_height (int32_t height) |
Sets or sets the height of the buffer area. | |
static int32_t | buffer_width () |
Gets the width of the buffer area. | |
static void | buffer_width (int32_t width) |
Sets the width of the buffer area. | |
static bool | caps_lock () |
Gets a value indicating whether the CAPS LOCK keyboard toggle is turned on or turned off. | |
static void | clear () |
Clears the console buffer and corresponding console window of display information. | |
static int32_t | cursor_left () |
Gets the column position of the cursor within the buffer area. | |
static void | cursor_left (int32_t left) |
Sets the column position of the cursor within the buffer area. | |
static int32_t | cursor_size () |
Gets or sets the height of the cursor within a character cell. | |
static void | cursor_size (int32_t size) |
Sets the height of the cursor within a character cell. | |
static int32_t | cursor_top () |
Gets the row position of the cursor within the buffer area. | |
static void | cursor_top (int32_t top) |
Sets the row position of the cursor within the buffer area. | |
static bool | cursor_visible () |
Gets a value indicating whether the cursor is visible. | |
static void | cursor_visible (bool visible) |
Sets a value indicating whether the cursor is visible. | |
static console_color | foreground_color () |
Gets the foreground color of the console. | |
static bool | foreground_color (console_color color) |
Sets the foreground color of the console. | |
static int32_t | input_code_page () |
Gets the code page the console uses to read input. | |
static bool | input_code_page (int32_t code_page) |
Sets the code page the console uses to read input. | |
static bool | is_error_redirected () |
Gets a value that indicates whether the error output stream has been redirected from the standard error stream. | |
static bool | is_in_redirected () |
Gets a value that indicates whether the input stream has been redirected from the standard input stream. | |
static bool | is_out_redirected () |
Gets a value that indicates whether the output stream has been redirected from the standard output stream. | |
static bool | key_available () |
Gets a value indicating whether a key press is available in the input stream. | |
static int32_t | largest_window_height () |
Gets the largest possible number of console window rows, based on the current font and screen resolution. | |
static int32_t | largest_window_width () |
Gets the largest possible number of console window columns, based on the current font and screen resolution. | |
static bool | number_lock () |
Gets a value indicating whether the NUM LOCK keyboard toggle is turned on or turned off. | |
static std::ostream | open_standard_error () |
Acquires the standard error stream. | |
static std::istream | open_standard_input () |
Acquires the standard input stream. | |
static std::ostream | open_standard_output () |
Acquires the standard output stream. | |
static int32_t | output_code_page () |
Gets the code page the console uses to write output. | |
static bool | output_code_page (int32_t code_page) |
Sets the code page the console uses to write output. | |
static console_key_info | read_key () |
Obtains the next character or function key pressed by the user. The pressed key is displayed in the console window. | |
static console_key_info | read_key (bool intercept) |
Obtains the next character or function key pressed by the user. The pressed key is optionally displayed in the console window. | |
static xtd::ustring | read_line () |
Reads the next line of characters from the standard input stream. | |
static bool | reset_color () |
Sets the foreground and background console colors to their defaults. | |
static void | set_cursor_position (int32_t left, int32_t top) |
Sets the position of the cursor. | |
static void | set_error (const std::ostream &os) |
Sets the error property to the specified std::ostream object. | |
static void | set_in (const std::istream &is) |
Sets the int property to the specified std::istream object. | |
static void | set_out (const std::ostream &os) |
Sets the out property to the specified std::ostream object. | |
static xtd::ustring | title () |
Gets the title to display in the console title bar. | |
static void | title (const xtd::ustring &title) |
Sets the title to display in the console title bar. | |
static bool | treat_control_c_as_input () |
Gets a value indicating whether the combination of the Control modifier key and C console key (Ctrl+C) is treated as ordinary input or as an interruption that is handled by the operating system. | |
static void | treat_control_c_as_input (bool treat_control_c_as_input) |
Sets a value indicating whether the combination of the Control modifier key and C console key (Ctrl+C) is treated as ordinary input or as an interruption that is handled by the operating system. | |
static int32_t | window_height () |
Gets the height of the console window area. | |
static void | window_height (int32_t height) |
Sets the height of the console window area. | |
static int32_t | window_left () |
Gets the left of the console window area. | |
static void | window_left (int32_t left) |
Sets the left of the console window area. | |
static int32_t | window_top () |
Gets the top of the console window area. | |
static void | window_top (int32_t top) |
Sets the top of the console window area. | |
static int32_t | window_width () |
Gets the width of the console window area. | |
static void | window_width (int32 width) |
Sets the width of the console window area. | |
template<typename arg_t > | |
static void | write (arg_t &&value) |
Writes the text representation of the specified value to the standard output stream. | |
template<typename ... args_t> | |
static void | write (const xtd::ustring &fmt, args_t &&... values) |
Writes the text representation of the specified list of values to the standard output stream using the specified format information. | |
static void | write_line () |
Writes the current line terminator to the standard output stream using the specified format information. | |
template<typename arg_t > | |
static void | write_line (arg_t &&value) |
Writes the text representation of the specified value, followed by the current line terminator, to the standard output stream. | |
template<typename ... args_t> | |
static void | write_line (const xtd::ustring &fmt, args_t &&... values) |
Writes the text representation of the specified list of values, followed by the current line terminator, to the standard output stream using the specified format information. | |
|
static |
Gets the background color of the console.
|
static |
Sets the background color of the console.
color | A xtd::console_color that specifies the background color of the console; that is, the color that appears behind each character. |
|
static |
Plays the sound of a beep through the console speaker.
|
static |
Plays the sound of a beep of a specified frequency and duration through the console speaker.
frequency | The frequency of the beep, ranging from 37 to 32767 hertz |
duration | The duration of the beep measured in milliseconds |
|
static |
Gets the height of the buffer area.
|
static |
Sets or sets the height of the buffer area.
height | The current height, in rows, of the buffer area. |
|
static |
Gets the width of the buffer area.
|
static |
Sets the width of the buffer area.
width | The current width, in columns, of the buffer area. |
|
static |
Gets a value indicating whether the CAPS LOCK keyboard toggle is turned on or turned off.
|
static |
Clears the console buffer and corresponding console window of display information.
|
static |
Gets the column position of the cursor within the buffer area.
|
static |
Sets the column position of the cursor within the buffer area.
left | The current position, in columns, of the cursor. |
|
static |
Gets or sets the height of the cursor within a character cell.
|
static |
Sets the height of the cursor within a character cell.
size | The size of the cursor expressed as a percentage of the height of a character cell. The property value ranges from 1 to 100. |
|
static |
Gets the row position of the cursor within the buffer area.
|
static |
Sets the row position of the cursor within the buffer area.
top | The current position, in rows, of the cursor. |
|
static |
Gets a value indicating whether the cursor is visible.
|
static |
Sets a value indicating whether the cursor is visible.
visible | true if the cursor is visible; otherwise, false. |
|
static |
Gets the foreground color of the console.
|
static |
Sets the foreground color of the console.
color | A console_color that specifies the foreground color of the console; that is, the color of each character that is displayed. |
|
static |
Gets the code page the console uses to read input.
|
static |
Sets the code page the console uses to read input.
code_page | The code page used to read console input. |
|
static |
Gets a value that indicates whether the error output stream has been redirected from the standard error stream.
true | if error output is redirected; otherwise, false. |
|
static |
Gets a value that indicates whether the input stream has been redirected from the standard input stream.
true | if input is redirected; otherwise, false. |
|
static |
Gets a value that indicates whether the output stream has been redirected from the standard output stream.
true | if output is redirected; otherwise, false. |
|
static |
Gets a value indicating whether a key press is available in the input stream.
true | if a key press is available; otherwise, false |
|
static |
Gets the largest possible number of console window rows, based on the current font and screen resolution.
The | height of the largest possible console window measured in rows. |
|
static |
Gets the largest possible number of console window columns, based on the current font and screen resolution.
The | width of the largest possible console window measured in columns. |
|
static |
Gets a value indicating whether the NUM LOCK keyboard toggle is turned on or turned off.
true | if NUM LOCK is turned on; false if NUM LOCK is turned off. |
|
static |
Acquires the standard error stream.
|
static |
Acquires the standard input stream.
|
static |
Acquires the standard output stream.
|
static |
Gets the code page the console uses to write output.
|
static |
Sets the code page the console uses to write output.
code_page | The code page used to write console output. |
|
static |
Obtains the next character or function key pressed by the user. The pressed key is displayed in the console window.
|
static |
Obtains the next character or function key pressed by the user. The pressed key is optionally displayed in the console window.
intercept | Determines whether to display the pressed key in the console window. true to not display the pressed key; otherwise, false |
|
static |
Reads the next line of characters from the standard input stream.
|
static |
Sets the foreground and background console colors to their defaults.
|
static |
Sets the position of the cursor.
left | The column position of the cursor. Columns are numbered from left to right starting at 0. |
top | The row position of the cursor. Rows are numbered from top to bottom starting at 0. |
|
static |
Sets the error property to the specified std::ostream object.
os | A stream that is the new standard error output. |
|
static |
Sets the int property to the specified std::istream object.
os | A stream that is the new standard input. |
|
static |
Sets the out property to the specified std::ostream object.
os | A stream that is the new standard output. |
|
static |
Gets the title to display in the console title bar.
|
static |
Sets the title to display in the console title bar.
title | The string to be displayed in the title bar of the console. The maximum length of the title string is 24500 characters. |
|
static |
Gets a value indicating whether the combination of the Control modifier key and C console key (Ctrl+C) is treated as ordinary input or as an interruption that is handled by the operating system.
|
static |
Sets a value indicating whether the combination of the Control modifier key and C console key (Ctrl+C) is treated as ordinary input or as an interruption that is handled by the operating system.
treat_control_c_as_input | true if Ctrl+C is treated as ordinary input; otherwise, false. |
|
static |
Gets the height of the console window area.
|
static |
Sets the height of the console window area.
height | The height of the console window measured in rows. |
|
static |
Gets the left of the console window area.
|
static |
Sets the left of the console window area.
left | The left of the console window measured in columns. |
|
static |
Gets the top of the console window area.
|
static |
Sets the top of the console window area.
top | The top of the console window measured in rows. |
|
static |
Gets the width of the console window area.
|
static |
Sets the width of the console window area.
width | The width of the console window measured in columns. |
|
inlinestatic |
Writes the text representation of the specified value to the standard output stream.
arg_t | The type of the value to write. |
value | The value to write, |
|
inlinestatic |
Writes the text representation of the specified list of values to the standard output stream using the specified format information.
...args_t | Types of the values to write. |
values | Values to write, |
|
static |
Writes the current line terminator to the standard output stream using the specified format information.
|
inlinestatic |
Writes the text representation of the specified value, followed by the current line terminator, to the standard output stream.
arg_t | The type of the value to write. |
value | The value to write, |
|
inlinestatic |
Writes the text representation of the specified list of values, followed by the current line terminator, to the standard output stream using the specified format information.
...args_t | Types of the values to write. |
values | Values to write, |
|
static |
Occurs when the Control modifier key (Ctrl) and either the ConsoleKey.C console key (C) or the Break key are pressed simultaneously (Ctrl+C or Ctrl+Break).
|
static |
Gets the error output stream. A std::basic_ostream<char_t> that represents the error output stream.
|
static |
Gets the standard input stream. A std::basic_istream<char_t> that represents the standard input stream.
|
static |
Gets the standard output stream. A std::basic_ostream<char_t> that represents the standard output stream.