Skip Navigation Links
Skip Navigation LinksHome > ZipArchive > How to Use > API Documentation

#include <BaseLibCompressor.h>

Inheritance diagram for ZipArchiveLib::CBaseLibCompressor:
Inheritance graph

Classes

struct  COptions
 

Public Member Functions

 CBaseLibCompressor (CZipStorage *pStorage)
 
void InitDecompression (CZipFileHeader *pFile, CZipCryptograph *pCryptograph)
 
- Public Member Functions inherited from CZipCompressor
virtual bool CanProcess (WORD uMethod)=0
 
virtual void Compress (const void *pBuffer, DWORD uSize)=0
 
virtual DWORD Decompress (void *pBuffer, DWORD uSize)=0
 
virtual void FinishCompression (bool bAfterException)
 
virtual void FinishDecompression (bool bAfterException)
 
virtual const COptionsGetOptions () const
 
virtual void InitCompression (int iLevel, CZipFileHeader *pFile, CZipCryptograph *pCryptograph)
 
bool PrepareForSeek (CZipFileHeader *pCurrentFile, COffsetsPair *pPair)
 
void UpdateOptions (const COptionsMap &optionsMap)
 

Protected Member Functions

void CheckForError (int iErr)
 
void EmptyPtrList ()
 
virtual bool IsCodeErrorOK (int iErr) const =0
 
void SetOpaque (void **opaque, const COptions *pOptions)
 
- Protected Member Functions inherited from CZipCompressor
virtual int ConvertInternalError (int iErr) const
 
 CZipCompressor (CZipStorage *pStorage)
 
DWORD FillBuffer ()
 
void FlushWriteBuffer ()
 
void InitBuffer ()
 
void ReleaseBuffer ()
 
void ThrowError (int iErr, bool bInternal=false)
 
void UpdateCrc (const void *pBuffer, DWORD uSize)
 
void UpdateFileCrc (const void *pBuffer, DWORD uSize)
 
virtual void UpdateOptions (const COptions *pOptions)
 
void WriteBuffer (char *pBuffer, DWORD uSize)
 

Static Protected Member Functions

static void * _zipalloc (void *opaque, UINT items, UINT size)
 
static void _zipfree (void *opaque, void *address)
 

Protected Attributes

bool m_bDecompressionDone
 
- Protected Attributes inherited from CZipCompressor
CZipAutoBuffer m_pBuffer
 A buffer that receives compressed data or provides data for decompression.
 
CZipCryptographm_pCryptograph
 The current cryptograph.
 
CZipFileHeaderm_pFile
 The file header being compressed or decompressed.
 
CZipStoragem_pStorage
 The current storage object.
 

Additional Inherited Members

- Public Types inherited from CZipCompressor
enum  CompressionLevel { levelDefault = -1, levelStore = 0, levelFastest = 1, levelBest = 9 }
 
enum  CompressionMethod { methodStore = 0, methodDeflate = 8, methodBzip2 = 12, methodWinZipAes = 99 }
 
enum  CompressorType { typeDeflate = 1, typeBzip2, typePPMd }
 
typedef CZipArray< COffsetsPair * > CZipOffsetsPairsArray
 
- Static Public Member Functions inherited from CZipCompressor
static CZipCompressorCreateCompressor (WORD uMethod, CZipStorage *pStorage)
 
static bool IsCompressionSupported (WORD uCompressionMethod)
 
- Public Attributes inherited from CZipCompressor
ZIP_SIZE_TYPE m_uComprLeft
 The number of bytes left to compress.
 
DWORD m_uCrc32
 The CRC32 file checksum.
 
ZIP_SIZE_TYPE m_uUncomprLeft
 The number of bytes left to decompress.
 

Detailed Description

A base class for compressors that use external libraries, such as zlib or bzip2.

Constructor & Destructor Documentation

ZipArchiveLib::CBaseLibCompressor::CBaseLibCompressor ( CZipStorage pStorage)
inline

Initializes a new instance of the CBaseLibCompressor class.

Parameters
pStorageThe current storage object.

Member Function Documentation

static void* ZipArchiveLib::CBaseLibCompressor::_zipalloc ( void *  opaque,
UINT  items,
UINT  size 
)
inlinestaticprotected

A memory allocation method called by an external library.

Parameters
opaqueInternal data.
itemsThe number of blocks to allocate.
sizeThe size of each block to allocate.
Returns
The address of a newly allocated memory.
static void ZipArchiveLib::CBaseLibCompressor::_zipfree ( void *  opaque,
void *  address 
)
inlinestaticprotected

A memory deallocation method called by an external library.

Parameters
opaqueInternal data.
addressMemory address to free.
void ZipArchiveLib::CBaseLibCompressor::CheckForError ( int  iErr)
inlineprotected

Checks whether iErr value is an error code and throws an exception if it is.

Parameters
iErrThe error code.
void ZipArchiveLib::CBaseLibCompressor::EmptyPtrList ( )
protected

Frees the memory allocated by an external library that hasn't been freed due to an error in the library (it should never happen).

void ZipArchiveLib::CBaseLibCompressor::InitDecompression ( CZipFileHeader pFile,
CZipCryptograph pCryptograph 
)
inlinevirtual

The method called when a new file is opened for extraction.

Parameters
pFileThe file being extracted.
pCryptographThe current CZipCryptograph. It can be NULL, if no decryption is used.
See Also
Decompress
FinishDecompression

Reimplemented from CZipCompressor.

Reimplemented in ZipArchiveLib::CBzip2Compressor.

virtual bool ZipArchiveLib::CBaseLibCompressor::IsCodeErrorOK ( int  iErr) const
protectedpure virtual

Checks whether iErr value is an error code.

Parameters
iErrThe code to check.
Returns
true, if iErr is an error code; false otherwise.

Implemented in ZipArchiveLib::CDeflateCompressor, and ZipArchiveLib::CBzip2Compressor.

void ZipArchiveLib::CBaseLibCompressor::SetOpaque ( void **  opaque,
const COptions pOptions 
)
protected

Sets an address of internal data used in ZipArchive Library memory allocation and deallocation methods.

Parameters
opaqueReceives an address of the internal data.
pOptionsThe current decompressor options.

Member Data Documentation

bool ZipArchiveLib::CBaseLibCompressor::m_bDecompressionDone
protected

Signalizes that the decompression process reached the end of the compressed data. It is internally set by derived classes.


The documentation for this class was generated from the following file:
Back To Top Up