.. _namespace_console: Namespace console ================= .. contents:: Contents :local: :backlinks: none Detailed Description -------------------- termcolor ~~~~~~~~~ termcolor is a header-only c++ library for printing colored messages to the terminal. Written just for fun with a help of the Force. :copyright: (c) 2013 by Igor Kalnitsky :license: BSD, see LICENSE for details */ the following snippet of code detects the current OS and defines the appropriate macro that is used to wrap some platform specific things This headers provides the ``isatty()``/``fileno()`` functions, which are used for testing whether a standart stream refers to the terminal. As for Windows, we also need WinApi funcs for changing colors attributes of the terminal. namespace ecl { Forward declaration of the ``console`` namespace. All comments are below. namespace console { inline FILE* :ref:`exhale_function_namespaceconsole_1aed2422f11855fb695007b38984c3b7d9`; inline bool :ref:`exhale_function_namespaceconsole_1a45aa461efdfa6aa41dc19f2396bf2f39`; } inline std::ostream& reset(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& bold(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& dark(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& underline(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& blink(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& reverse(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& concealed(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& grey(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& red(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& green(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& yellow(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& blue(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& magenta(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& cyan(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& white(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& on_grey(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& on_red(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& on_green(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& on_yellow(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& on_blue(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& on_magenta(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& on_cyan(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } inline std::ostream& on_white(std::ostream& stream) { if (console::is_atty(stream)) { } return stream; } /*! Since C++ hasn't a way to hide something in the header from the outer access, I have to introduce this namespace which is used for internal purpose and should't be access from the user code. Functions --------- - :ref:`exhale_function_namespaceconsole_1aed2422f11855fb695007b38984c3b7d9` - :ref:`exhale_function_namespaceconsole_1a45aa461efdfa6aa41dc19f2396bf2f39`