33#ifndef NEKTAR_LIBUTILITIES_PROGRESSBAR_HPP
34#define NEKTAR_LIBUTILITIES_PROGRESSBAR_HPP
44#define ISTTY _isatty(_fileno(stdout))
47#define ISTTY isatty(fileno(stdout))
66 const std::string message,
int lastprogress = -1)
68 std::cout.unsetf(std::ios::floatfield);
71 float progress = position / float(goal);
72 int numeq =
static_cast<int>(ceil(progress * 49));
73 if (lastprogress == numeq)
82 std::cout << message <<
": ";
84 std::cout << std::setw(3) << ceil(100 * progress) <<
"% [";
85 for (
int j = 0; j < numeq; j++)
89 for (
int j = numeq; j < 49; j++)
93 std::cout <<
"]" << std::flush;
100 if (
int(ceil(
double(100 * position / goal))) % 2 == 0)
102 std::cout <<
"." << std::flush;
int PrintProgressbar(const int position, const int goal, const std::string message, int lastprogress=-1)
Prints a progressbar.