Progresscounter
Public Member Functions | List of all members
ProgressCounter Class Reference

#include <ProgressCounter.hpp>

Public Member Functions

 ProgressCounter ()
 
 ProgressCounter (size_t max, size_t counter=0)
 
void reset ()
 
void setMaximum (size_t maxElements)
 
void setCounter (size_t counter)
 
void increment ()
 
void print () const
 
float getPercent () const
 
size_t getCounter () const
 
size_t getMaxElements () const
 
std::string getString () const
 

Detailed Description

A text based progress counter.

Constructor & Destructor Documentation

◆ ProgressCounter() [1/2]

ProgressCounter::ProgressCounter ( )

Initializes a progress counter with range 0 - 100.

◆ ProgressCounter() [2/2]

ProgressCounter::ProgressCounter ( size_t  max,
size_t  counter = 0 
)

Initializes a progress counter with a custom range.

Parameters
maxThe maximum value the counter can reach.
counterThe initial value of the counter.

Member Function Documentation

◆ getCounter()

size_t ProgressCounter::getCounter ( ) const
Returns
size_t The counter's current value.

◆ getMaxElements()

size_t ProgressCounter::getMaxElements ( ) const
Returns
size_t The maximum value the counter can reach.

◆ getPercent()

float ProgressCounter::getPercent ( ) const
Returns
float The counter's current percentage.

◆ getString()

std::string ProgressCounter::getString ( ) const
Returns
std::string Returns the current percentage formatted as a string as it would be printed by the class.

◆ increment()

void ProgressCounter::increment ( )

Increments the counter by one.

◆ print()

void ProgressCounter::print ( ) const

Prints the new percentage, if it has changed.

◆ reset()

void ProgressCounter::reset ( )

Resets the counter to zero

◆ setCounter()

void ProgressCounter::setCounter ( size_t  counter)

Sets the counter to a new value.

Parameters
counterThe counter's new value.

◆ setMaximum()

void ProgressCounter::setMaximum ( size_t  maxElements)

Sets a new maximum value for the counter.

Parameters
maxElementsThe maximum value the counter can reach.

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