xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Go to the documentation of this file.
1 #pragma once
5 #include "console.h"
6 #include "object.h"
9 namespace xtd {
17  class foreground_color final : public object {
18  public:
19  explicit foreground_color(console_color color) : color_(color) {}
22  friend std::ostream& operator<<(std::ostream& os, const foreground_color& color) {
23  if (console::is_out_redirected() && os.rdbuf() == console::out.rdbuf())
24  console::foreground_color(color.color_);
25  return os;
26  }
29  private:
30  console_color color_;
31  };
32 }
Represent foreground color output manipulator class.
Definition: foreground_color.h:17
static bool is_out_redirected()
Gets a value that indicates whether the output stream has been redirected from the standard output st...
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Specifies constants that define foreground and background colors for the console. ...
Definition: console_color.h:17
Contains xtd::object class.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:26
Contains xtd::console class.
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:39