diff options
Diffstat (limited to 'src/shared/ProgressBar.cpp')
-rw-r--r-- | src/shared/ProgressBar.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/shared/ProgressBar.cpp b/src/shared/ProgressBar.cpp index 509e24b4a5b..61d037bb42e 100644 --- a/src/shared/ProgressBar.cpp +++ b/src/shared/ProgressBar.cpp @@ -17,19 +17,24 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include <stdio.h> + #include "ProgressBar.h" + char const* const barGoLink::empty = " "; #ifdef _WIN32 char const* const barGoLink::full = "\x3D"; #else char const* const barGoLink::full = "*"; #endif + barGoLink::~barGoLink() { printf( "\n" ); fflush(stdout); } + barGoLink::barGoLink( int row_count ) { rec_no = 0; @@ -41,7 +46,7 @@ barGoLink::barGoLink( int row_count ) #else printf( "[" ); #endif - for ( int i = 0; i < indic_len; i++ ) printf( empty ); + for (int i = 0; i < indic_len; i++ ) printf( empty ); #ifdef _WIN32 printf( "\x3D 0%%\r\x3D" ); #else @@ -49,9 +54,11 @@ barGoLink::barGoLink( int row_count ) #endif fflush(stdout); } + void barGoLink::step( void ) { int i, n; + if ( num_rec == 0 ) return; ++rec_no; n = rec_no * indic_len / num_rec; @@ -62,8 +69,8 @@ void barGoLink::step( void ) #else printf( "\r[" ); #endif - for ( i = 0; i < n; i++ ) printf( full ); - for ( ; i < indic_len; i++ ) printf( empty ); + for (i = 0; i < n; i++ ) printf( full ); + for (; i < indic_len; i++ ) printf( empty ); float percent = (((float)n/(float)indic_len)*100); #ifdef _WIN32 printf( "\x3D %i%% \r\x3D", (int)percent); @@ -71,6 +78,7 @@ void barGoLink::step( void ) printf( "] %i%% \r[", (int)percent); #endif fflush(stdout); + rec_pos = n; } } |