1 // PercentPrinter.h 2 3 #ifndef __PERCENTPRINTER_H 4 #define __PERCENTPRINTER_H 5 6 #include "Common/Types.h" 7 #include "Common/StdOutStream.h" 8 9 class CPercentPrinter 10 { 11 UInt64 m_MinStepSize; 12 UInt64 m_PrevValue; 13 UInt64 m_CurValue; 14 UInt64 m_Total; 15 int m_NumExtraChars; 16 public: 17 CStdOutStream *OutStream; 18 19 CPercentPrinter(UInt64 minStepSize = 1): m_MinStepSize(minStepSize), 20 m_PrevValue(0), m_CurValue(0), m_Total(1), m_NumExtraChars(0) {} 21 void SetTotal(UInt64 total) { m_Total = total; m_PrevValue = 0; } 22 void SetRatio(UInt64 doneValue) { m_CurValue = doneValue; } 23 void PrintString(const char *s); 24 void PrintString(const wchar_t *s); 25 void PrintNewLine(); 26 void ClosePrint(); 27 void RePrintRatio(); 28 void PrintRatio(); 29 }; 30 31 #endif 32