Home | History | Annotate | Download | only in 7z
      1 // 7zCompressionMode.h
      2 
      3 #ifndef __7Z_COMPRESSION_MODE_H
      4 #define __7Z_COMPRESSION_MODE_H
      5 
      6 #include "../../Common/MethodId.h"
      7 #include "../../Common/MethodProps.h"
      8 
      9 namespace NArchive {
     10 namespace N7z {
     11 
     12 struct CMethodFull: public CMethodProps
     13 {
     14   CMethodId Id;
     15   UInt32 NumStreams;
     16   int CodecIndex;
     17 
     18   CMethodFull(): CodecIndex(-1) {}
     19   bool IsSimpleCoder() const { return NumStreams == 1; }
     20 };
     21 
     22 struct CBond2
     23 {
     24   UInt32 OutCoder;
     25   UInt32 OutStream;
     26   UInt32 InCoder;
     27 };
     28 
     29 struct CCompressionMethodMode
     30 {
     31   /*
     32     if (Bonds.Empty()), then default bonds must be created
     33     if (Filter_was_Inserted)
     34     {
     35       Methods[0] is filter method
     36       Bonds don't contain bonds for filter (these bonds must be created)
     37     }
     38   */
     39 
     40   CObjectVector<CMethodFull> Methods;
     41   CRecordVector<CBond2> Bonds;
     42 
     43   bool IsThereBond_to_Coder(unsigned coderIndex) const
     44   {
     45     FOR_VECTOR(i, Bonds)
     46       if (Bonds[i].InCoder == coderIndex)
     47         return true;
     48     return false;
     49   }
     50 
     51   bool DefaultMethod_was_Inserted;
     52   bool Filter_was_Inserted;
     53 
     54   #ifndef _7ZIP_ST
     55   UInt32 NumThreads;
     56   bool MultiThreadMixer;
     57   #endif
     58 
     59   bool PasswordIsDefined;
     60   UString Password;
     61 
     62   bool IsEmpty() const { return (Methods.IsEmpty() && !PasswordIsDefined); }
     63   CCompressionMethodMode():
     64       DefaultMethod_was_Inserted(false),
     65       Filter_was_Inserted(false),
     66       PasswordIsDefined(false)
     67       #ifndef _7ZIP_ST
     68       , NumThreads(1)
     69       , MultiThreadMixer(true)
     70       #endif
     71   {}
     72 };
     73 
     74 }}
     75 
     76 #endif
     77