summaryrefslogtreecommitdiff
path: root/other-licenses/7zstub/src/7zip/Archive/7z/7zFolderOutStream.h
blob: 05a6358c7ef87a9744a7d1e152b104fc8593cd6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// 7zFolderOutStream.h

#ifndef __7Z_FOLDEROUTSTREAM_H
#define __7Z_FOLDEROUTSTREAM_H

#include "7zIn.h"

#include "../../IStream.h"
#include "../IArchive.h"
#include "../Common/OutStreamWithCRC.h"

namespace NArchive {
namespace N7z {

class CFolderOutStream: 
  public ISequentialOutStream,
  public CMyUnknownImp
{
public:
  MY_UNKNOWN_IMP
  
  CFolderOutStream();

  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
private:

  COutStreamWithCRC *_outStreamWithHashSpec;
  CMyComPtr<ISequentialOutStream> _outStreamWithHash;
  const CArchiveDatabaseEx *_archiveDatabase;
  const CBoolVector *_extractStatuses;
  UInt32 _startIndex;
  UInt32 _ref2Offset;
  int _currentIndex;
  // UInt64 _currentDataPos;
  CMyComPtr<IArchiveExtractCallback> _extractCallback;
  bool _testMode;

  bool _fileIsOpen;
  UInt64 _filePos;

  HRESULT OpenFile();
  HRESULT WriteEmptyFiles();
public:
  HRESULT Init(
      const CArchiveDatabaseEx *archiveDatabase,
      UInt32 ref2Offset,
      UInt32 startIndex,
      const CBoolVector *extractStatuses, 
      IArchiveExtractCallback *extractCallback,
      bool testMode);
  HRESULT FlushCorrupted(Int32 resultEOperationResult);
  HRESULT WasWritingFinished();
};

}}

#endif