• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // OpenCallbackConsole.h
2 
3 #ifndef __OPEN_CALLBACK_CONSOLE_H
4 #define __OPEN_CALLBACK_CONSOLE_H
5 
6 #include "../../../Common/StdOutStream.h"
7 
8 #include "../Common/ArchiveOpenCallback.h"
9 
10 #include "PercentPrinter.h"
11 
12 class COpenCallbackConsole: public IOpenCallbackUI
13 {
14 protected:
15   CPercentPrinter _percent;
16 
17   CStdOutStream *_so;
18   CStdOutStream *_se;
19 
20   bool _totalFilesDefined;
21   // bool _totalBytesDefined;
22   // UInt64 _totalFiles;
23   UInt64 _totalBytes;
24 
NeedPercents()25   bool NeedPercents() const { return _percent._so != NULL; }
26 
27 public:
28 
29   bool MultiArcMode;
30 
ClosePercents()31   void ClosePercents()
32   {
33     if (NeedPercents())
34       _percent.ClosePrint(true);
35   }
36 
COpenCallbackConsole()37   COpenCallbackConsole():
38       _totalFilesDefined(false),
39       // _totalBytesDefined(false),
40       _totalBytes(0),
41       MultiArcMode(false)
42 
43       #ifndef _NO_CRYPTO
44       , PasswordIsDefined(false)
45       // , PasswordWasAsked(false)
46       #endif
47 
48       {}
49 
Init(CStdOutStream * outStream,CStdOutStream * errorStream,CStdOutStream * percentStream)50   void Init(CStdOutStream *outStream, CStdOutStream *errorStream, CStdOutStream *percentStream)
51   {
52     _so = outStream;
53     _se = errorStream;
54     _percent._so = percentStream;
55   }
56 
57   INTERFACE_IOpenCallbackUI(;)
58 
59   #ifndef _NO_CRYPTO
60   bool PasswordIsDefined;
61   // bool PasswordWasAsked;
62   UString Password;
63   #endif
64 };
65 
66 #endif
67