misc/libphysfs/lzma/CPP/7zip/Compress/Branch/BranchCoder.h
changeset 13904 99b265e0d1d0
parent 13903 5f819b90d479
child 13905 b172a5d40eee
equal deleted inserted replaced
13903:5f819b90d479 13904:99b265e0d1d0
     1 // BranchCoder.h
       
     2 
       
     3 #ifndef __BRANCH_CODER_H
       
     4 #define __BRANCH_CODER_H
       
     5 
       
     6 #include "Common/MyCom.h"
       
     7 #include "Common/Types.h"
       
     8 
       
     9 #include "../../ICoder.h"
       
    10 
       
    11 class CBranchConverter:
       
    12   public ICompressFilter,
       
    13   public CMyUnknownImp
       
    14 {
       
    15 protected:
       
    16   UInt32 _bufferPos;
       
    17   virtual void SubInit() {}
       
    18   virtual UInt32 SubFilter(Byte *data, UInt32 size) = 0;
       
    19 public:
       
    20   MY_UNKNOWN_IMP;
       
    21   STDMETHOD(Init)();
       
    22   STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
       
    23 };
       
    24 
       
    25 #define MyClassEncoderA(Name) class C ## Name: public CBranchConverter \
       
    26   { public: UInt32 SubFilter(Byte *data, UInt32 size); }; 
       
    27 
       
    28 #define MyClassDecoderA(Name) class C ## Name: public CBranchConverter \
       
    29   { public: UInt32 SubFilter(Byte *data, UInt32 size); }; 
       
    30 
       
    31 #define MyClassEncoderB(Name, ADD_ITEMS, ADD_INIT) class C ## Name: public CBranchConverter, public ADD_ITEMS \
       
    32   { public: UInt32 SubFilter(Byte *data, UInt32 size); ADD_INIT}; 
       
    33 
       
    34 #define MyClassDecoderB(Name, ADD_ITEMS, ADD_INIT) class C ## Name: public CBranchConverter, public ADD_ITEMS \
       
    35   { public: UInt32 SubFilter(Byte *data, UInt32 size); ADD_INIT}; 
       
    36 
       
    37 #define MyClassA(Name, id, subId)  \
       
    38 MyClassEncoderA(Name ## _Encoder) \
       
    39 MyClassDecoderA(Name ## _Decoder)
       
    40 
       
    41 #define MyClassB(Name, id, subId, ADD_ITEMS, ADD_INIT)  \
       
    42 MyClassEncoderB(Name ## _Encoder, ADD_ITEMS, ADD_INIT) \
       
    43 MyClassDecoderB(Name ## _Decoder, ADD_ITEMS, ADD_INIT)
       
    44 
       
    45 #endif