xtd 0.2.0
Loading...
Searching...
No Matches
foreground_color.h
Go to the documentation of this file.
1
4#pragma once
5#include "console.h"
6#include "object.h"
7
9namespace xtd {
20 class foreground_color final : public object {
21 public:
23
31 explicit foreground_color(console_color color) : color_(color) {}
33
35 friend std::ostream& operator <<(std::ostream& os, const foreground_color& color) {
36 if (!console::is_output_redirected() && os.rdbuf() == console::out.rdbuf())
37 console::foreground_color(color.color_);
38 return os;
39 }
41
42 private:
43 console_color color_;
44 };
45}
static console_color foreground_color()
Gets the foreground color of the console.
static std::ostream out
Gets the standard output stream. A std::basic_ostream<char_t> that represents the standard output str...
Definition console.h:49
static bool is_output_redirected()
Gets a value that indicates whether the output stream has been redirected from the standard output st...
Represent foreground color output manipulator class.
Definition foreground_color.h:20
foreground_color(console_color color)
Sets the foreground color of the console.
Definition foreground_color.h:31
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:32
Contains xtd::console class.
console_color
Specifies constants that define foreground and background colors for the console.
Definition console_color.h:18
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::object class.