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 
     17   bool IsSimpleCoder() const { return NumStreams == 1; }
     18 };
     19 
     20 struct CBond2
     21 {
     22   UInt32 OutCoder;
     23   UInt32 OutStream;
     24   UInt32 InCoder;
     25 };
     26 
     27 struct CCompressionMethodMode
     28 {
     29   /*
     30     if (Bonds.Empty()), then default bonds must be created
     31     if (Filter_was_Inserted)
     32     {
     33       Methods[0] is filter method
     34       Bonds don't contain bonds for filter (these bonds must be created)
     35     }
     36   */
     37 
     38   CObjectVector<CMethodFull> Methods;
     39   CRecordVector<CBond2> Bonds;
     40 
     41   bool IsThereBond_to_Coder(unsigned coderIndex) const
     42   {
     43     FOR_VECTOR(i, Bonds)
     44       if (Bonds[i].InCoder == coderIndex)
     45         return true;
     46     return false;
     47   }
     48 
     49   bool DefaultMethod_was_Inserted;
     50   bool Filter_was_Inserted;
     51 
     52   #ifndef _7ZIP_ST
     53   UInt32 NumThreads;
     54   bool MultiThreadMixer;
     55   #endif
     56 
     57   bool PasswordIsDefined;
     58   UString Password;
     59 
     60   bool IsEmpty() const { return (Methods.IsEmpty() && !PasswordIsDefined); }
     61   CCompressionMethodMode():
     62       DefaultMethod_was_Inserted(false),
     63       Filter_was_Inserted(false),
     64       PasswordIsDefined(false)
     65       #ifndef _7ZIP_ST
     66       , NumThreads(1)
     67       , MultiThreadMixer(true)
     68       #endif
     69   {}
     70 };
     71 
     72 }}
     73 
     74 #endif
     75