#include <xtd/collections/generic/list>
#include <xtd/char32_object>
#include <xtd/console>
#include <xtd/startup>
namespace console_clear_example {
class program {
public:
auto continue_flag = true;
do {
auto fore_color_selection = get_key_press(
"Select Text Color (B for Blue, R for Red, Y for Yellow): ",
list<char32_t> {
'B',
'R',
'Y' });
switch (fore_color_selection) {
case 'B':
case 'R':
case 'Y':
}
auto back_color_selection = get_key_press(
"Select Background Color (W for White, G for Green, M for Magenta): ",
list<char32_t> {
'W',
'G',
'M' });
switch (back_color_selection) {
case 'W':
case 'G':
case 'M':
}
continue_flag = false;
} while (continue_flag);
}
private:
static char32_t get_key_press(
const string& msg,
const list<char32_t>& valid_chars) {
auto valid = false;
do {
valid = true;
} while (!valid);
return key_pressed.key_char();
}
};
}
startup_(console_clear_example::program::main);
static char to_upper(char32 c) noexcept
Definition box_char.hpp:204
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:79
const_iterator begin() const noexcept override
Returns an iterator to the first element of the enumarable.
Definition list.hpp:253
const_iterator end() const noexcept override
Returns an iterator to the element following the last element of the enumarable.
Definition list.hpp:366
Specifies the standard keys on a console.
Definition console_key_info.hpp:24
static xtd::string read_line()
Reads the next line of characters from the standard input stream.
static void write(arg_t &&value)
Writes the text representation of the specified value to the standard output stream.
Definition console.hpp:462
static console_color background_color()
Gets the background color of the console.
static console_color foreground_color()
Gets the foreground color of the console.
static void clear()
Clears the console buffer and corresponding console window of display information.
static console_key_info read_key()
Obtains the next character or function key pressed by the user. The pressed key is displayed in the c...
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:167
xtd::array< xtd::string > argument_collection
Represents the collection of arguments passed to the main entry point method.
Definition argument_collection.hpp:19
@ black
The color black.
Definition console_color.hpp:24
@ dark_blue
The color dark blue.
Definition console_color.hpp:26
@ magenta
The color magenta (purplish red).
Definition console_color.hpp:50
@ dark_red
The color dark red.
Definition console_color.hpp:32
@ green
The color green.
Definition console_color.hpp:44
@ white
The color white.
Definition console_color.hpp:54
@ dark_yellow
The color dark yellow (ochre).
Definition console_color.hpp:36
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition comparer.hpp:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8