1 // PercentPrinter.h 2 3 #ifndef __PERCENT_PRINTER_H 4 #define __PERCENT_PRINTER_H 5 6 #include "../../../Common/StdOutStream.h" 7 8 struct CPercentPrinterState 9 { 10 UInt64 Completed; 11 UInt64 Total; 12 13 UInt64 Files; 14 15 AString Command; 16 UString FileName; 17 18 void ClearCurState(); 19 CPercentPrinterStateCPercentPrinterState20 CPercentPrinterState(): 21 Completed(0), 22 Total((UInt64)(Int64)-1), 23 Files(0) 24 {} 25 }; 26 27 class CPercentPrinter: public CPercentPrinterState 28 { 29 UInt32 _tickStep; 30 DWORD _prevTick; 31 32 AString _s; 33 34 AString _printedString; 35 AString _temp; 36 UString _tempU; 37 38 CPercentPrinterState _printedState; 39 AString _printedPercents; 40 41 void GetPercents(); 42 43 public: 44 CStdOutStream *_so; 45 46 bool NeedFlush; 47 unsigned MaxLen; 48 49 CPercentPrinter(UInt32 tickStep = 200): _tickStep(tickStep)50 _tickStep(tickStep), 51 _prevTick(0), 52 NeedFlush(true), 53 MaxLen(80 - 1) 54 {} 55 56 ~CPercentPrinter(); 57 58 void ClosePrint(bool needFlush); 59 void Print(); 60 }; 61 62 #endif 63