Files
terminal_status_line/Progress.cpp

40 lines
675 B
C++

#include "ProgressFinite.h"
#include <sstream>
using std::ostream;
using std::string;
using std::stringstream;
Progress::Progress(const string& message, size_t current)
: m_message(message),
m_current(current)
{}
void Progress::set_message(const std::string& message)
{
m_message = message;
}
void Progress::set_progress(size_t current)
{
m_current = current;
}
void Progress::increment_progress(size_t inc)
{
m_current += inc;
}
string Progress::print_progress() const
{
stringstream out;
out << m_current << " - " << m_message;
return out.str();
}
ostream& operator<<(ostream& out, const Progress& progress)
{
out << progress.print_progress();
return out;
}