00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef SH_PROGRESSOUTPUT_H
00022 #define SH_PROGRESSOUTPUT_H
00023
00024 #include <cstdarg>
00025 #include <ctime>
00026 #include <string>
00027
00032 class ProgressOutput {
00033 public:
00037 ProgressOutput (void) ;
00038
00043 ProgressOutput (const std::string& m) ;
00044
00045 void setMessage (const std::string& m)
00046 { Message = m ; } ;
00047
00048 void setMessage (const char *msgfmt, ...) ;
00049
00053 void update (float rate) ;
00054
00058 void done (void) const ;
00059
00065 void done (float rate, float avgweight = NoAvgWeight) const ;
00066
00067 static const float NoAvgWeight = -1.0 ;
00068
00069 protected:
00070 std::string vcompose (const char *msgfmt, va_list ap) const ;
00071
00072 private:
00073 std::string Message ;
00074 time_t LastUpdate ;
00075 } ;
00076
00077 #endif // ndef SH_PROGRESSOUTPUT_H