michael@0: // BranchCoder.h michael@0: michael@0: #ifndef __BRANCH_CODER_H michael@0: #define __BRANCH_CODER_H michael@0: michael@0: #include "Common/MyCom.h" michael@0: #include "Common/Types.h" michael@0: #include "Common/Alloc.h" michael@0: michael@0: #include "../../ICoder.h" michael@0: michael@0: class CBranchConverter: michael@0: public ICompressFilter, michael@0: public CMyUnknownImp michael@0: { michael@0: protected: michael@0: UInt32 _bufferPos; michael@0: virtual void SubInit() {} michael@0: virtual UInt32 SubFilter(Byte *data, UInt32 size) = 0; michael@0: public: michael@0: MY_UNKNOWN_IMP; michael@0: STDMETHOD(Init)(); michael@0: STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size); michael@0: }; michael@0: michael@0: #define MyClassEncoderA(Name) class C ## Name: public CBranchConverter \ michael@0: { public: UInt32 SubFilter(Byte *data, UInt32 size); }; michael@0: michael@0: #define MyClassDecoderA(Name) class C ## Name: public CBranchConverter \ michael@0: { public: UInt32 SubFilter(Byte *data, UInt32 size); }; michael@0: michael@0: #define MyClassEncoderB(Name, ADD_ITEMS, ADD_INIT) class C ## Name: public CBranchConverter, public ADD_ITEMS \ michael@0: { public: UInt32 SubFilter(Byte *data, UInt32 size); ADD_INIT}; michael@0: michael@0: #define MyClassDecoderB(Name, ADD_ITEMS, ADD_INIT) class C ## Name: public CBranchConverter, public ADD_ITEMS \ michael@0: { public: UInt32 SubFilter(Byte *data, UInt32 size); ADD_INIT}; michael@0: michael@0: #define MyClass2b(Name, id, subId, encodingId) \ michael@0: DEFINE_GUID(CLSID_CCompressConvert ## Name, \ michael@0: 0x23170F69, 0x40C1, 0x278B, 0x03, 0x03, id, subId, 0x00, 0x00, encodingId, 0x00); michael@0: michael@0: #define MyClassA(Name, id, subId) \ michael@0: MyClass2b(Name ## _Encoder, id, subId, 0x01) \ michael@0: MyClassEncoderA(Name ## _Encoder) \ michael@0: MyClass2b(Name ## _Decoder, id, subId, 0x00) \ michael@0: MyClassDecoderA(Name ## _Decoder) michael@0: michael@0: #define MyClassB(Name, id, subId, ADD_ITEMS, ADD_INIT) \ michael@0: MyClass2b(Name ## _Encoder, id, subId, 0x01) \ michael@0: MyClassEncoderB(Name ## _Encoder, ADD_ITEMS, ADD_INIT) \ michael@0: MyClass2b(Name ## _Decoder, id, subId, 0x00) \ michael@0: MyClassDecoderB(Name ## _Decoder, ADD_ITEMS, ADD_INIT) michael@0: michael@0: #endif