Archived
1
Fork 0
This repository has been archived on 2025-04-09. You can view files and clone it, but cannot push or open issues or pull requests.
it-works/logging
2011-11-05 22:55:01 +01:00
..
main.cpp added md 2011-11-05 22:53:47 +01:00
progressbar.hpp added md 2011-11-05 22:53:47 +01:00
README.md TextEdit.app trolled me 2011-11-05 22:55:01 +01:00

Usage:

Wrap your for loop in an extra scope with a progressbar, like this:

{	// extra scope
	Progressbar p(std::cout);
	for(i = 0; i < 1000; ++i){
		...
		p.show(i, 999);
	}
}	// end extra scope (destructor of Progressbar will be used).

You can give extra information to show in the constructor: Progressbar p(stream, "prefix", "Start message", " End message"); this will look like:

Start message
prefix [===============>               ]
End message

You may leave these things empty ("").

NOTE: the width of the bar (incl. prefix) is fixed ATM. NOTE: pass the maximum-value to the function show, not the bound of the for-loop (this way the function also works nicely for floating types)