xieite::term {}

Defined in header <xieite/io/term.hpp>

A class for controlling standard I/O with toggleable "modes" and text styles. Currently only supports unix-like platforms.


Definition

struct term {
	std::FILE* in;
	std::FILE* out;

	term(std::FILE* = stdin, std::FILE* = stdout) noexcept;

	term(const xieite::term&) = delete;

	~term();

	void block(bool) noexcept;

	void echo(bool) noexcept;

	void canon(bool) noexcept;

	void signal(bool) noexcept;

	void proc(bool) noexcept;

	static constexpr std::string fg_code(std::uint8_t, std::uint8_t, std::uint8_t) noexcept;

	static constexpr std::string fg_code(const xieite::color3&) noexcept;

	void fg(std::uint8_t, std::uint8_t, std::uint8_t) noexcept;

	void fg(const xieite::color3&) noexcept;

	static constexpr std::string fg_reset_code() noexcept;

	void fg_reset() noexcept;

	static constexpr std::string bg_code(std::uint8_t, std::uint8_t, std::uint8_t) noexcept;

	static constexpr std::string bg_code(const xieite::color3&) noexcept;

	void bg(std::uint8_t, std::uint8_t, std::uint8_t) noexcept;

	void bg(const xieite::color3&) noexcept;

	static constexpr std::string bg_reset_code() noexcept;

	void bg_reset() noexcept;

	static constexpr std::string bold_code(bool) noexcept;

	void bold(bool) noexcept;

	static constexpr std::string italic_code(bool) noexcept;

	void italic(bool) noexcept;

	static constexpr std::string underl_code(bool) noexcept;

	void underl(bool) noexcept;

	static constexpr std::string blink_code(bool) noexcept;

	void blink(bool) noexcept;

	static constexpr std::string invis_code(bool) noexcept;

	void invis(bool) noexcept;

	static constexpr std::string strike_code(bool) noexcept;

	void strike(bool) noexcept;

	static constexpr std::string invert_code(bool) noexcept;

	void invert(bool) noexcept;

	static constexpr std::string reset_style_code() noexcept;

	void reset_style() noexcept;

	void reset_mode() noexcept;

	xieite::vec2<int> get_cursor() noexcept;

	static constexpr std::string set_cursor_code(int, int) noexcept;

	static constexpr std::string set_cursor_code(xieite::vec2<int>) noexcept;

	void set_cursor(int, int) noexcept;

	void set_cursor(xieite::vec2<int>) noexcept;

	static constexpr std::string mv_cursor_code(int, int) noexcept;

	static constexpr std::string mv_cursor_code(xieite::vec2<int>) noexcept;

	void mv_cursor(int, int) noexcept;

	void mv_cursor(xieite::vec2<int>) noexcept;

	static constexpr std::string cursor_invis_code(bool) noexcept;

	void cursor_invis(bool) noexcept;

	static constexpr std::string cursor_block_code(bool) noexcept;

	void cursor_block(bool) noexcept;

	static constexpr std::string cursor_undersc_code(bool) noexcept;

	void cursor_undersc(bool) noexcept;

	static constexpr std::string cursor_pipe_code(bool) noexcept;

	void cursor_pipe(bool) noexcept;

	static constexpr std::string cursor_alt_code(bool) noexcept;

	void cursor_alt(bool) noexcept;

	static constexpr std::string screen_alt_code(bool) noexcept;

	void screen_alt(bool) noexcept;

	xieite::vec2<int> screen_size() noexcept;

	static constexpr std::string clear_screen_code() noexcept;

	void clear_screen() noexcept;

	static constexpr std::string clear_screen_until_code() noexcept;

	void clear_screen_until() noexcept;

	static constexpr std::string clear_screen_from_code() noexcept;

	void clear_screen_from() noexcept;

	static constexpr std::string clear_line_code() noexcept;

	void clear_line() noexcept;

	static constexpr std::string clear_line_until_code() noexcept;

	void clear_line_until() noexcept;

	static constexpr std::string clear_line_from_code() noexcept;

	void clear_line_from() noexcept;

	int read_ch() noexcept;

	std::string read_str() noexcept;

	xieite::keys read_key() noexcept;
};


Example

int main() {
	xieite::term term;
	term.fg(255, 0, 0);
	std::puts("Hello, world!");
}
Possible output:
Hello, world!
[View in Compiler Explorer]