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