AnCH Framework 0.1
Another C++ Hack Framework
Loading...
Searching...
No Matches
anch::cli::Formatter Struct Reference

Console formatter. More...

#include <formatter.hpp>

Collaboration diagram for anch::cli::Formatter:

Public Member Functions

 Formatter ()
virtual ~Formatter ()
Formatterbold (bool state=true)
Formatterunderline (bool state=true)
Formatterblink (bool state=true)
Formatterreset ()
FormatterfgColor (const Color &color)
FormatterfgColor (const std::array< uint8_t, 3 > &color)
FormatterbgColor (const Color &color)
FormatterbgColor (const std::array< uint8_t, 3 > &color)

Static Public Member Functions

static Formatter format ()

Public Attributes

std::optional< Color > _fg_color
std::optional< std::array< uint8_t, 3 > > _rgb_fg_color
std::optional< Color > _bg_color
std::optional< std::array< uint8_t, 3 > > _rgb_bg_color
std::optional< bool > _bold = false
std::optional< bool > _underline = false
std::optional< bool > _blink = false
bool _reset = false

Static Public Attributes

static bool DISABLED

Detailed Description

Console formatter.

Console formatter utility in fluent API

Author
Vincent Lachenal

Constructor & Destructor Documentation

◆ Formatter()

anch::cli::Formatter::Formatter ( )

Formatter default constructor

◆ ~Formatter()

virtual anch::cli::Formatter::~Formatter ( )
virtual

Formatter destructor

Member Function Documentation

◆ bgColor() [1/2]

Formatter & anch::cli::Formatter::bgColor ( const Color & color)

Set background color

Parameters
colorthe predefined color to use
Returns
this
Here is the call graph for this function:

◆ bgColor() [2/2]

Formatter & anch::cli::Formatter::bgColor ( const std::array< uint8_t, 3 > & color)

Set background color

Parameters
colorthe RGB color to use
Returns
this
Here is the call graph for this function:

◆ blink()

Formatter & anch::cli::Formatter::blink ( bool state = true)

Set blink/unblink

Parameters
statethe flag (default to true )
Returns
this
Here is the call graph for this function:

◆ bold()

Formatter & anch::cli::Formatter::bold ( bool state = true)

Set bold/unbold

Parameters
statethe flag (default to true )
Returns
this
Here is the call graph for this function:

◆ fgColor() [1/2]

Formatter & anch::cli::Formatter::fgColor ( const Color & color)

Set text color

Parameters
colorthe predefined color to use
Returns
this
Here is the call graph for this function:

◆ fgColor() [2/2]

Formatter & anch::cli::Formatter::fgColor ( const std::array< uint8_t, 3 > & color)

Set text color

Parameters
colorthe RGB color to use
Returns
this
Here is the call graph for this function:

◆ format()

Formatter anch::cli::Formatter::format ( )
static

Initialize formatter for fluent API usage

Returns
the new Formatter
Here is the call graph for this function:

◆ reset()

Formatter & anch::cli::Formatter::reset ( )

Set reset flag to true . Every other flag will be ignored.

Returns
this
Here is the call graph for this function:

◆ underline()

Formatter & anch::cli::Formatter::underline ( bool state = true)

Set underline/ununderline

Parameters
statethe flag (default to true )
Returns
this
Here is the call graph for this function:

Member Data Documentation

◆ _bg_color

std::optional<Color> anch::cli::Formatter::_bg_color

Background color (with predefined colors)

◆ _blink

std::optional<bool> anch::cli::Formatter::_blink = false

Blink text flag

◆ _bold

std::optional<bool> anch::cli::Formatter::_bold = false

Bold text flag

◆ _fg_color

std::optional<Color> anch::cli::Formatter::_fg_color

Text color (with predefined colors)

◆ _reset

bool anch::cli::Formatter::_reset = false

Reset formatting flag

◆ _rgb_bg_color

std::optional<std::array<uint8_t,3> > anch::cli::Formatter::_rgb_bg_color

Background color (with RGB colors)

◆ _rgb_fg_color

std::optional<std::array<uint8_t,3> > anch::cli::Formatter::_rgb_fg_color

Text color (with RGB colors)

◆ _underline

std::optional<bool> anch::cli::Formatter::_underline = false

Underline text flag

◆ DISABLED

bool anch::cli::Formatter::DISABLED
static

Disable console formatter globally


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