1 // XzHandler.h
2 
3 #ifndef __XZ_HANDLER_H
4 #define __XZ_HANDLER_H
5 
6 #include "../../../C/Xz.h"
7 
8 #include "../ICoder.h"
9 
10 namespace NArchive {
11 namespace NXz {
12 
13 struct CXzUnpackerCPP
14 {
15   Byte *InBuf;
16   Byte *OutBuf;
17   CXzUnpacker p;
18 
19   CXzUnpackerCPP();
20   ~CXzUnpackerCPP();
21 };
22 
23 struct CStatInfo
24 {
25   UInt64 InSize;
26   UInt64 OutSize;
27   UInt64 PhySize;
28 
29   UInt64 NumStreams;
30   UInt64 NumBlocks;
31 
32   bool UnpackSize_Defined;
33 
34   bool NumStreams_Defined;
35   bool NumBlocks_Defined;
36 
37   bool IsArc;
38   bool UnexpectedEnd;
39   bool DataAfterEnd;
40   bool Unsupported;
41   bool HeadersError;
42   bool DataError;
43   bool CrcError;
44 
CStatInfoCStatInfo45   CStatInfo() { Clear(); }
46 
47   void Clear();
48 };
49 
50 struct CDecoder: public CStatInfo
51 {
52   CXzUnpackerCPP xzu;
53   SRes DecodeRes; // it's not HRESULT
54 
CDecoderCDecoder55   CDecoder(): DecodeRes(SZ_OK) {}
56 
57   /* Decode() can return ERROR code only if there is progress or stream error.
58      Decode() returns S_OK in case of xz decoding error, but DecodeRes and CStatInfo contain error information */
59   HRESULT Decode(ISequentialInStream *seqInStream, ISequentialOutStream *outStream, ICompressProgressInfo *compressProgress);
60   Int32 Get_Extract_OperationResult() const;
61 };
62 
63 }}
64 
65 #endif
66