33 #ifndef NEKTAR_LIBUTILITIES_PROGRESSBAR_HPP
34 #define NEKTAR_LIBUTILITIES_PROGRESSBAR_HPP
44 #define ISTTY _isatty(_fileno(stdout))
47 #define ISTTY isatty(fileno(stdout))
52 namespace LibUtilities
68 const int position,
const int goal,
const std::string message,
69 int lastprogress = -1)
71 std::cout.unsetf ( std::ios::floatfield );
74 float progress = position / float(goal);
75 int numeq =
static_cast<int>(ceil(progress *49));
76 if(lastprogress == numeq)
85 std::cout << message <<
": ";
87 std::cout << std::setw(3) << ceil(100 * progress) <<
"% [";
88 for (
int j = 0; j < numeq; j++)
92 for (
int j = numeq; j < 49; j++)
96 std::cout <<
"]" << std::flush;
103 if (
int(ceil(
double(100 * position / goal))) % 2 == 0)
105 std::cout <<
"." << std::flush;
int PrintProgressbar(const int position, const int goal, const std::string message, int lastprogress=-1)
Prints a progressbar.
The above copyright notice and this permission notice shall be included.