PercentPrinter.h 750 B

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