ModErn Text Analysis
META Enumerates Textual Applications
Classes | Functions
meta::printing Namespace Reference

Contains functions that print to the terminal and provide progress bars. More...

Classes

class  progress
 Simple class for reporting progress of lengthy operations. More...
 

Functions

std::string add_commas (const std::string &number)
 
std::string make_green (std::string str)
 
std::string make_red (std::string str)
 
std::string make_bold (std::string str)
 
std::string bytes_to_units (double num_bytes)
 Converts a number of bytes into a human-readable number. More...
 
void show_progress (size_t idx, size_t max, size_t freq, const std::string &prefix="")
 
void end_progress (const std::string &prefix)
 Ends output from a call to show_progess by displaying 100% completion. More...
 

Detailed Description

Contains functions that print to the terminal and provide progress bars.

Function Documentation

std::string meta::printing::add_commas ( const std::string &  number)
inline
Parameters
numberThe string-encoded number
Returns
the parameter with commas added every thousandths place
std::string meta::printing::make_green ( std::string  str)
inline
Parameters
strThe string to turn green
Returns
the parameter string colored green
std::string meta::printing::make_red ( std::string  str)
inline
Parameters
strThe string to turn red
Returns
the parameter string colored red
std::string meta::printing::make_bold ( std::string  str)
inline
Parameters
strThe string to turn bold
Returns
the parameter string bolded
std::string meta::printing::bytes_to_units ( double  num_bytes)
inline

Converts a number of bytes into a human-readable number.

Parameters
num_bytesThe number in bytes to convert
Returns
a human-readable string
void meta::printing::show_progress ( size_t  idx,
size_t  max,
size_t  freq,
const std::string &  prefix = "" 
)
inline
Parameters
idxThe current progress in the operation
maxThe maximum value of idx, when it is done
freqHow often to write output to the terminal
prefixThe text to show before the percentage
void meta::printing::end_progress ( const std::string &  prefix)
inline

Ends output from a call to show_progess by displaying 100% completion.

Parameters
prefixThe text to show before the percentage