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