osmanip
Library with useful output stream tools like: color and style manipulators, progress bars and terminal graphics.
Public Member Functions | List of all members
osm::ProgressBar< bar_type > Class Template Reference

Template class used to create customized progress bars. More...

#include <progress_bar.hpp>

Public Member Functions

 ProgressBar ()
 Construct a new ProgressBar <bar_type>::ProgressBar object. Default constructor which set to null values the main attributes. More...
 
 ProgressBar (const bar_type &min, const bar_type &max)
 Construct a new ProgressBar <bar_type>::ProgressBar object. Parametric constructor which set to null values the main attributes except max_ and min which will be initialized respectively with max and min. More...
 
void setMax (bar_type max)
 Set the maximum value of the ProgressBar. More...
 
void setMin (bar_type min)
 Set the minimum value of the ProgressBar. More...
 
void setStyle (const std::string &type, const std::string &style)
 Set the type and style of the ProgressBar. Available: "indicator" ("%", "/100"), "loader" ("#", "■"), "spinner" ("/-\\|"). More...
 
void setStyle (const std::string &type, const std::string &style_p, const std::string &style_l)
 Set the style of the complete ProgressBar. Available: "indicator" ("%", "/100"), "loader" ("#", "■"), "spinner" ("/-\\|") and "complete" with both indicator first and loader second. More...
 
void setMessage (std::string_view message)
 Set the message of the ProgressBar. More...
 
void setBegin ()
 Set begin time count. More...
 
void setEnd ()
 Set end time count. More...
 
void setBrackets (std::string_view brackets_open, std::string_view brackets_close)
 Set brackets of the ProgressBar. More...
 
void setColor (const std::string &color)
 Set the color of the ProgressBar. More...
 
void setRemainingTimeFlag (std::string_view time_flag)
 Set the remaining time of the ProgressBar. More...
 
void resetAll ()
 Reset the ProgressBar variables. More...
 
void resetMax ()
 Reset the ProgressBar Max variable. More...
 
void resetMin ()
 Reset the ProgressBar Min variable. More...
 
void resetStyle ()
 Reset the ProgressBar Style variable. More...
 
void resetMessage ()
 Reset the ProgressBar Message variable. More...
 
void resetTime ()
 Reset the ProgressBar time count. More...
 
void resetRemainingTime ()
 Reset the ProgressBar time remaining count. More...
 
void resetBrackets ()
 Reset the ProgressBar brackets. More...
 
void resetColor ()
 Reset the ProgressBar color. More...
 
bar_type getMax () const
 Get the ProgressBar Max variable. More...
 
bar_type getMin () const
 Get the ProgressBar Min variable. More...
 
long long getTime () const
 Get the ProgressBar current time value. More...
 
bar_type getIteratingVar () const
 Get the ProgressBar iterating variable value. More...
 
std::string getStyle () const
 Get the ProgressBar Style variable. More...
 
std::string getStyleComplete () const
 Get the ProgressBar Style variable for "complete" variable type. More...
 
std::string getType () const
 Get the ProgressBar Type variable. More...
 
std::string getMessage () const
 Get the ProgressBar Message variable. More...
 
std::string getBrackets_open () const
 Get the ProgressBar brackets_open variable. More...
 
std::string getBrackets_close () const
 Get the ProgressBar brackets_close variable. More...
 
std::string getColor () const
 Get the ProgressBar color variable. More...
 
std::string getColorName () const
 Get the ProgressBar color name variable. More...
 
std::string getRemainingTimeFlag () const
 Get the ProgressBar time remaining variable. More...
 
void update (bar_type iterating_var)
 Update the progress bar indicator. More...
 
void print () const
 Prints on the screen the progress bar variable values. More...
 
void addStyle (const std::string &type, const std::string &style)
 Add customized styles to the ProgressBar. More...
 

Detailed Description

template<typename bar_type>
class osm::ProgressBar< bar_type >

Template class used to create customized progress bars.

Template Parameters
bar_typeIt is the type of the progress bar.

Constructor & Destructor Documentation

◆ ProgressBar() [1/2]

template<typename bar_type >
osm::ProgressBar< bar_type >::ProgressBar ( )
inline

Construct a new ProgressBar <bar_type>::ProgressBar object. Default constructor which set to null values the main attributes.

Template Parameters
bar_typeThe type of the ProgressBar.

◆ ProgressBar() [2/2]

template<typename bar_type >
osm::ProgressBar< bar_type >::ProgressBar ( const bar_type &  min,
const bar_type &  max 
)
inlineexplicit

Construct a new ProgressBar <bar_type>::ProgressBar object. Parametric constructor which set to null values the main attributes except max_ and min which will be initialized respectively with max and min.

Template Parameters
bar_typeThe type of the ProgressBar.
Parameters
minThe minimum value of the ProgressBar.
maxThe maximum value of the ProgressBar.

Member Function Documentation

◆ addStyle()

template<typename bar_type >
void osm::ProgressBar< bar_type >::addStyle ( const std::string &  type,
const std::string &  style 
)
inline

Add customized styles to the ProgressBar.

Template Parameters
bar_typeThe type of the ProgressBar.
Parameters
typeThe type of the ProgressBar.
styleThe style of the ProgressBar.

◆ getBrackets_close()

template<typename bar_type >
std::string osm::ProgressBar< bar_type >::getBrackets_close ( ) const
inline

Get the ProgressBar brackets_close variable.

Template Parameters
bar_typeThe type of the ProgressBar.
Returns
The ProgressBar brackets_close variable.

◆ getBrackets_open()

template<typename bar_type >
std::string osm::ProgressBar< bar_type >::getBrackets_open ( ) const
inline

Get the ProgressBar brackets_open variable.

Template Parameters
bar_typeThe type of the ProgressBar.
Returns
The ProgressBar brackets_open variable.

◆ getColor()

template<typename bar_type >
std::string osm::ProgressBar< bar_type >::getColor ( ) const
inline

Get the ProgressBar color variable.

Template Parameters
bar_typeThe type of the ProgressBar.
Returns
The ProgressBar color variable.

◆ getColorName()

template<typename bar_type >
std::string osm::ProgressBar< bar_type >::getColorName ( ) const
inline

Get the ProgressBar color name variable.

Template Parameters
bar_typeThe type of the ProgressBar.
Returns
The ProgressBar color name variable.

◆ getIteratingVar()

template<typename bar_type >
bar_type osm::ProgressBar< bar_type >::getIteratingVar ( ) const
inline

Get the ProgressBar iterating variable value.

Template Parameters
bar_typeThe type of the ProgressBar.
Returns
The ProgressBar iterating variable value.

◆ getMax()

template<typename bar_type >
bar_type osm::ProgressBar< bar_type >::getMax ( ) const
inline

Get the ProgressBar Max variable.

Template Parameters
bar_typeThe type of the ProgressBar.
Returns
The ProgressBar Max variable.

◆ getMessage()

template<typename bar_type >
std::string osm::ProgressBar< bar_type >::getMessage ( ) const
inline

Get the ProgressBar Message variable.

Template Parameters
bar_typeThe type of the ProgressBar.
Returns
The ProgressBar Message variable.

◆ getMin()

template<typename bar_type >
bar_type osm::ProgressBar< bar_type >::getMin ( ) const
inline

Get the ProgressBar Min variable.

Template Parameters
bar_typeThe type of the ProgressBar.
Returns
The ProgressBar Min variable.

◆ getRemainingTimeFlag()

template<typename bar_type >
std::string osm::ProgressBar< bar_type >::getRemainingTimeFlag ( ) const
inline

Get the ProgressBar time remaining variable.

Template Parameters
bar_typeThe type of the ProgressBar.
Returns
The ProgressBar time remaining variable.

◆ getStyle()

template<typename bar_type >
std::string osm::ProgressBar< bar_type >::getStyle ( ) const
inline

Get the ProgressBar Style variable.

Template Parameters
bar_typeThe type of the ProgressBar.
Returns
The ProgressBar Style variable.

◆ getStyleComplete()

template<typename bar_type >
std::string osm::ProgressBar< bar_type >::getStyleComplete ( ) const
inline

Get the ProgressBar Style variable for "complete" variable type.

Template Parameters
bar_typeThe style of the ProgressBar.
Returns
The ProgressBar Type variable.

◆ getTime()

template<typename bar_type >
long long osm::ProgressBar< bar_type >::getTime ( ) const
inline

Get the ProgressBar current time value.

Template Parameters
bar_typeThe type of the ProgressBar.
Returns
The ProgressBar current time value.

◆ getType()

template<typename bar_type >
std::string osm::ProgressBar< bar_type >::getType ( ) const
inline

Get the ProgressBar Type variable.

Template Parameters
bar_typeThe type of the ProgressBar.
Returns
The ProgressBar Type variable.

◆ print()

template<typename bar_type >
void osm::ProgressBar< bar_type >::print ( ) const
inline

Prints on the screen the progress bar variable values.

Template Parameters
bar_typeThe type of the ProgressBar.

◆ resetAll()

template<typename bar_type >
void osm::ProgressBar< bar_type >::resetAll ( )
inline

Reset the ProgressBar variables.

Template Parameters
bar_typeThe type of the ProgressBar.

◆ resetBrackets()

template<typename bar_type >
void osm::ProgressBar< bar_type >::resetBrackets ( )
inline

Reset the ProgressBar brackets.

Template Parameters
bar_typeThe type of the ProgressBar.

◆ resetColor()

template<typename bar_type >
void osm::ProgressBar< bar_type >::resetColor ( )
inline

Reset the ProgressBar color.

Template Parameters
bar_typeThe type of the ProgressBar.

◆ resetMax()

template<typename bar_type >
void osm::ProgressBar< bar_type >::resetMax ( )
inline

Reset the ProgressBar Max variable.

Template Parameters
bar_typeThe type of the ProgressBar.

◆ resetMessage()

template<typename bar_type >
void osm::ProgressBar< bar_type >::resetMessage ( )
inline

Reset the ProgressBar Message variable.

Template Parameters
bar_typeThe type of the ProgressBar.

◆ resetMin()

template<typename bar_type >
void osm::ProgressBar< bar_type >::resetMin ( )
inline

Reset the ProgressBar Min variable.

Template Parameters
bar_typeThe type of the ProgressBar.

◆ resetRemainingTime()

template<typename bar_type >
void osm::ProgressBar< bar_type >::resetRemainingTime ( )
inline

Reset the ProgressBar time remaining count.

Template Parameters
bar_typeThe type of the ProgressBar.

◆ resetStyle()

template<typename bar_type >
void osm::ProgressBar< bar_type >::resetStyle ( )
inline

Reset the ProgressBar Style variable.

Template Parameters
bar_typeThe type of the ProgressBar.

◆ resetTime()

template<typename bar_type >
void osm::ProgressBar< bar_type >::resetTime ( )
inline

Reset the ProgressBar time count.

Template Parameters
bar_typeThe type of the ProgressBar.

◆ setBegin()

template<typename bar_type >
void osm::ProgressBar< bar_type >::setBegin ( )
inline

Set begin time count.

Template Parameters
bar_typeThe type of the ProgressBar.

◆ setBrackets()

template<typename bar_type >
void osm::ProgressBar< bar_type >::setBrackets ( std::string_view  brackets_open,
std::string_view  brackets_close 
)
inline

Set brackets of the ProgressBar.

Template Parameters
bar_typeThe type of the ProgressBar.
Parameters
brackets_openOpen bracket.
brackets_closeClose bracket.

◆ setColor()

template<typename bar_type >
void osm::ProgressBar< bar_type >::setColor ( const std::string &  color)
inline

Set the color of the ProgressBar.

Template Parameters
bar_typeThe type of the ProgressBar.
Parameters
colorThe color of the ProgressBar.

◆ setEnd()

template<typename bar_type >
void osm::ProgressBar< bar_type >::setEnd ( )
inline

Set end time count.

Template Parameters
bar_typeThe type of the* ProgressBar.

◆ setMax()

template<typename bar_type >
void osm::ProgressBar< bar_type >::setMax ( bar_type  max)
inline

Set the maximum value of the ProgressBar.

Template Parameters
bar_typeThe type of the ProgressBar.
Parameters
maxThe maximum value of the ProgressBar.

◆ setMessage()

template<typename bar_type >
void osm::ProgressBar< bar_type >::setMessage ( std::string_view  message)
inline

Set the message of the ProgressBar.

Template Parameters
bar_typeThe type of the ProgressBar.
Parameters
messageThe message of the ProgressBar.

◆ setMin()

template<typename bar_type >
void osm::ProgressBar< bar_type >::setMin ( bar_type  min)
inline

Set the minimum value of the ProgressBar.

Template Parameters
bar_typeThe type of the ProgressBar.
Parameters
minThe minimum value of the ProgressBar.

◆ setRemainingTimeFlag()

template<typename bar_type >
void osm::ProgressBar< bar_type >::setRemainingTimeFlag ( std::string_view  time_flag)
inline

Set the remaining time of the ProgressBar.

Template Parameters
bar_typeThe type of the ProgressBar.
Parameters
time_flagThe flag of the remaining time.

◆ setStyle() [1/2]

template<typename bar_type >
void osm::ProgressBar< bar_type >::setStyle ( const std::string &  type,
const std::string &  style 
)
inline

Set the type and style of the ProgressBar. Available: "indicator" ("%", "/100"), "loader" ("#", "■"), "spinner" ("/-\\|").

Template Parameters
bar_typeThe type of the ProgressBar.
Parameters
typeThe type (flavor) of the ProgressBar.
styleThe style of the ProgressBar. Available:

◆ setStyle() [2/2]

template<typename bar_type >
void osm::ProgressBar< bar_type >::setStyle ( const std::string &  type,
const std::string &  style_p,
const std::string &  style_l 
)
inline

Set the style of the complete ProgressBar. Available: "indicator" ("%", "/100"), "loader" ("#", "■"), "spinner" ("/-\\|") and "complete" with both indicator first and loader second.

Template Parameters
bar_typeThe type of the ProgressBar.
Parameters
typeThe type (flavor) of the ProgressBar.
style_pThe style of the percentage part of the progress bar.
style_lThe style of the bar part of the progress bar.

◆ update()

template<typename bar_type >
void osm::ProgressBar< bar_type >::update ( bar_type  iterating_var)
inline

Update the progress bar indicator.

Template Parameters
bar_typeThe type of the ProgressBar.
Parameters
valueThe value of the progress bar indicator.

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