• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // OpenCallbackConsole.h
2 
3 #ifndef ZIP7_INC_OPEN_CALLBACK_CONSOLE_H
4 #define ZIP7_INC_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   // UInt64 _totalFiles;
21   UInt64 _totalBytes;
22   bool _totalFilesDefined;
23   // bool _totalBytesDefined;
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       _totalBytes(0),
39       _totalFilesDefined(false),
40       // _totalBytesDefined(false),
41       MultiArcMode(false)
42 
43       #ifndef Z7_NO_CRYPTO
44       , PasswordIsDefined(false)
45       // , PasswordWasAsked(false)
46       #endif
47 
48       {}
49 
~COpenCallbackConsole()50   virtual ~COpenCallbackConsole() {}
51 
Init(CStdOutStream * outStream,CStdOutStream * errorStream,CStdOutStream * percentStream)52   void Init(CStdOutStream *outStream, CStdOutStream *errorStream, CStdOutStream *percentStream)
53   {
54     _so = outStream;
55     _se = errorStream;
56     _percent._so = percentStream;
57   }
58 
59   Z7_IFACE_IMP(IOpenCallbackUI)
60 
61   #ifndef Z7_NO_CRYPTO
62   bool PasswordIsDefined;
63   // bool PasswordWasAsked;
64   UString Password;
65   #endif
66 };
67 
68 #endif
69