xref: /aosp_15_r20/external/lzma/CPP/7zip/Archive/Common/MultiStream.h (revision f6dc9357d832569d4d1f5d24eacdb3935a1ae8e6)
1 // MultiStream.h
2 
3 #ifndef ZIP7_INC_MULTI_STREAM_H
4 #define ZIP7_INC_MULTI_STREAM_H
5 
6 #include "../../../Common/MyCom.h"
7 #include "../../../Common/MyVector.h"
8 
9 #include "../../IStream.h"
10 #include "../../Archive/IArchive.h"
11 
12 Z7_CLASS_IMP_IInStream(
13   CMultiStream
14 )
15 
16   unsigned _streamIndex;
17   UInt64 _pos;
18   UInt64 _totalLength;
19 
20 public:
21 
22   struct CSubStreamInfo
23   {
24     CMyComPtr<IInStream> Stream;
25     UInt64 Size;
26     UInt64 GlobalOffset;
27     UInt64 LocalPos;
CSubStreamInfoCSubStreamInfo28     CSubStreamInfo(): Size(0), GlobalOffset(0), LocalPos(0) {}
29   };
30 
31   CMyComPtr<IArchiveUpdateCallbackFile> updateCallbackFile;
32   CObjectVector<CSubStreamInfo> Streams;
33 
Init()34   HRESULT Init()
35   {
36     UInt64 total = 0;
37     FOR_VECTOR (i, Streams)
38     {
39       CSubStreamInfo &s = Streams[i];
40       s.GlobalOffset = total;
41       total += s.Size;
42       s.LocalPos = 0;
43       {
44         // it was already set to start
45         // RINOK(InStream_GetPos(s.Stream, s.LocalPos));
46       }
47     }
48     _totalLength = total;
49     _pos = 0;
50     _streamIndex = 0;
51     return S_OK;
52   }
53 };
54 
55 /*
56 Z7_CLASS_IMP_COM_1(
57   COutMultiStream,
58   IOutStream
59 )
60   Z7_IFACE_COM7_IMP(ISequentialOutStream)
61 
62   unsigned _streamIndex; // required stream
63   UInt64 _offsetPos; // offset from start of _streamIndex index
64   UInt64 _absPos;
65   UInt64 _length;
66 
67   struct CSubStreamInfo
68   {
69     CMyComPtr<ISequentialOutStream> Stream;
70     UInt64 Size;
71     UInt64 Pos;
72  };
73   CObjectVector<CSubStreamInfo> Streams;
74 public:
75   CMyComPtr<IArchiveUpdateCallback2> VolumeCallback;
76   void Init()
77   {
78     _streamIndex = 0;
79     _offsetPos = 0;
80     _absPos = 0;
81     _length = 0;
82   }
83 };
84 */
85 
86 #endif
87