1// 7z/Handler.h
2
3#ifndef __7Z_HANDLER_H
4#define __7Z_HANDLER_H
5
6#include "../../ICoder.h"
7#include "../IArchive.h"
8
9#include "../../Common/CreateCoder.h"
10
11#ifndef EXTRACT_ONLY
12#include "../Common/HandlerOut.h"
13#endif
14
15#include "7zCompressionMode.h"
16#include "7zIn.h"
17
18namespace NArchive {
19namespace N7z {
20
21#ifndef __7Z_SET_PROPERTIES
22
23#ifdef EXTRACT_ONLY
24#if !defined(_7ZIP_ST) && !defined(_SFX)
25#define __7Z_SET_PROPERTIES
26#endif
27#else
28#define __7Z_SET_PROPERTIES
29#endif
30
31#endif
32
33
34class CHandler:
35  #ifndef EXTRACT_ONLY
36  public NArchive::COutHandler,
37  #endif
38  public IInArchive,
39  #ifdef __7Z_SET_PROPERTIES
40  public ISetProperties,
41  #endif
42  #ifndef EXTRACT_ONLY
43  public IOutArchive,
44  #endif
45  PUBLIC_ISetCompressCodecsInfo
46  public CMyUnknownImp
47{
48public:
49  MY_QUERYINTERFACE_BEGIN2(IInArchive)
50  #ifdef __7Z_SET_PROPERTIES
51  MY_QUERYINTERFACE_ENTRY(ISetProperties)
52  #endif
53  #ifndef EXTRACT_ONLY
54  MY_QUERYINTERFACE_ENTRY(IOutArchive)
55  #endif
56  QUERY_ENTRY_ISetCompressCodecsInfo
57  MY_QUERYINTERFACE_END
58  MY_ADDREF_RELEASE
59
60  INTERFACE_IInArchive(;)
61
62  #ifdef __7Z_SET_PROPERTIES
63  STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties);
64  #endif
65
66  #ifndef EXTRACT_ONLY
67  INTERFACE_IOutArchive(;)
68  #endif
69
70  DECL_ISetCompressCodecsInfo
71
72  CHandler();
73
74private:
75  CMyComPtr<IInStream> _inStream;
76  NArchive::N7z::CArchiveDatabaseEx _db;
77  #ifndef _NO_CRYPTO
78  bool _passwordIsDefined;
79  #endif
80
81  #ifdef EXTRACT_ONLY
82
83  #ifdef __7Z_SET_PROPERTIES
84  UInt32 _numThreads;
85  #endif
86
87  UInt32 _crcSize;
88
89  #else
90
91  CRecordVector<CBind> _binds;
92
93  HRESULT SetCompressionMethod(CCompressionMethodMode &method,
94      CObjectVector<COneMethodInfo> &methodsInfo
95      #ifndef _7ZIP_ST
96      , UInt32 numThreads
97      #endif
98      );
99
100  HRESULT SetCompressionMethod(
101      CCompressionMethodMode &method,
102      CCompressionMethodMode &headerMethod);
103
104  #endif
105
106  bool IsEncrypted(UInt32 index2) const;
107  #ifndef _SFX
108
109  CRecordVector<UInt64> _fileInfoPopIDs;
110  void FillPopIDs();
111
112  #endif
113
114  DECL_EXTERNAL_CODECS_VARS
115};
116
117}}
118
119#endif
120