nomlib
Loading...
Searching...
No Matches
nom::UnixConsoleOutput Class Reference

#include <UnixConsoleOutput.hpp>

Inheritance diagram for nom::UnixConsoleOutput:
[legend]

Public Member Functions

virtual ~UnixConsoleOutput ()
 Destructor; if a TTY device is detected, an attempt to reset the colors will be made.
void set_color (ConsoleOutput::Color color)
 Implements ConsoleOutput::set_color.
void set_style (uint32 style)
 Implements ConsoleOutput::set_style.
void endl ()
 Implements ConsoleOutput::reset_colors.
Public Member Functions inherited from nom::ConsoleOutput
 ConsoleOutput ()
 Default constructor; initializes the output stream to use std::cerr (the standard error stream).
 ConsoleOutput (std::ostream &os)
 Construct a console output object with a custom output stream.
ConsoleOutput::Color color () const
 Get the last color that was set.
bool use_color () const
 Get the current use state of colored output logging.

Private Member Functions

bool tty () const
 Check to see if we are running inside a TTY device (terminal).

Private Attributes

const std::string COLOR_ENDL = "\e[0m"
 Reset colors.
const std::string COLOR_FG_RED = "\033[31m"
const std::string COLOR_FG_BLUE = "\033[34m"
const std::string COLOR_FG_YELLOW = "\033[93m"
const std::string COLOR_FG_MAGENTA = "\033[35m"
const std::string COLOR_FG_GREEN = "\033[0;32m"
const std::string COLOR_FG_ORANGE = "\033[0;33m"
const std::string COLOR_FG_PURPLE = "\033[0;35m"
const std::string COLOR_STYLE_BOLD = "\e[1;1m"
const std::string COLOR_STYLE_UNDERLINED = "\e[1;4m"

Additional Inherited Members

Public Types inherited from nom::ConsoleOutput
enum  Color {
  FG_WHITE , FG_RED , FG_GREEN , FG_BLUE ,
  FG_MAGENTA , FG_YELLOW , FG_ORANGE , FG_PURPLE
}
enum  : uint32 { STYLE_NONE = 0 , STYLE_BOLD = 0x1 , STYLE_UNDERLINED = 0x2 }
Protected Attributes inherited from nom::ConsoleOutput
std::ostream & out_
 The output stream to use; i.e.: std::cout or std::cerr.
ConsoleOutput::Color lcolor_
 The last color used.

Detailed Description

Member Function Documentation

◆ endl()

void nom::UnixConsoleOutput::endl ( )
virtual

Implements ConsoleOutput::reset_colors.

Reimplemented from nom::ConsoleOutput.

◆ set_color()

void nom::UnixConsoleOutput::set_color ( ConsoleOutput::Color color)
virtual

Implements ConsoleOutput::set_color.

Reimplemented from nom::ConsoleOutput.

◆ set_style()

void nom::UnixConsoleOutput::set_style ( uint32 style)
virtual

Implements ConsoleOutput::set_style.

Reimplemented from nom::ConsoleOutput.

◆ tty()

bool nom::UnixConsoleOutput::tty ( ) const
private

Check to see if we are running inside a TTY device (terminal).

Remarks
Color output for logging is enabled if we are in a TTY device.

Member Data Documentation

◆ COLOR_ENDL

const std::string nom::UnixConsoleOutput::COLOR_ENDL = "\e[0m"
private

Reset colors.

Definition at line 68 of file UnixConsoleOutput.hpp.

◆ COLOR_FG_BLUE

const std::string nom::UnixConsoleOutput::COLOR_FG_BLUE = "\033[34m"
private

Definition at line 72 of file UnixConsoleOutput.hpp.

◆ COLOR_FG_GREEN

const std::string nom::UnixConsoleOutput::COLOR_FG_GREEN = "\033[0;32m"
private

Definition at line 76 of file UnixConsoleOutput.hpp.

◆ COLOR_FG_MAGENTA

const std::string nom::UnixConsoleOutput::COLOR_FG_MAGENTA = "\033[35m"
private

Definition at line 74 of file UnixConsoleOutput.hpp.

◆ COLOR_FG_ORANGE

const std::string nom::UnixConsoleOutput::COLOR_FG_ORANGE = "\033[0;33m"
private

Definition at line 77 of file UnixConsoleOutput.hpp.

◆ COLOR_FG_PURPLE

const std::string nom::UnixConsoleOutput::COLOR_FG_PURPLE = "\033[0;35m"
private

Definition at line 78 of file UnixConsoleOutput.hpp.

◆ COLOR_FG_RED

const std::string nom::UnixConsoleOutput::COLOR_FG_RED = "\033[31m"
private

Definition at line 70 of file UnixConsoleOutput.hpp.

◆ COLOR_FG_YELLOW

const std::string nom::UnixConsoleOutput::COLOR_FG_YELLOW = "\033[93m"
private

Definition at line 73 of file UnixConsoleOutput.hpp.

◆ COLOR_STYLE_BOLD

const std::string nom::UnixConsoleOutput::COLOR_STYLE_BOLD = "\e[1;1m"
private

Definition at line 80 of file UnixConsoleOutput.hpp.

◆ COLOR_STYLE_UNDERLINED

const std::string nom::UnixConsoleOutput::COLOR_STYLE_UNDERLINED = "\e[1;4m"
private

Definition at line 81 of file UnixConsoleOutput.hpp.


The documentation for this class was generated from the following file: