#include <ZipCompressor.h>
List of all members.
Classes |
| class | COffsetsArray |
| struct | COffsetsPair |
| struct | COptions |
| class | COptionsMap |
Public Types |
| 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 |
Public Member Functions |
| 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 COptions * | GetOptions () const |
| virtual void | InitCompression (int iLevel, CZipFileHeader *pFile, CZipCryptograph *pCryptograph) |
| virtual void | InitDecompression (CZipFileHeader *pFile, CZipCryptograph *pCryptograph) |
| bool | PrepareForSeek (CZipFileHeader *pCurrentFile, COffsetsPair *pPair) |
| void | UpdateOptions (const COptionsMap &optionsMap) |
Static Public Member Functions |
| static CZipCompressor * | CreateCompressor (WORD uMethod, CZipStorage *pStorage) |
| static bool | IsCompressionSupported (WORD uCompressionMethod) |
Public Attributes |
| 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.
|
Protected Member Functions |
| 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) |
Protected Attributes |
| CZipAutoBuffer | m_pBuffer |
| | A buffer that receives compressed data or provides data for decompression.
|
| CZipCryptograph * | m_pCryptograph |
| | The current cryptograph.
|
| CZipFileHeader * | m_pFile |
| | The file header being compressed or decompressed.
|
| CZipStorage * | m_pStorage |
| | The current storage object.
|
Detailed Description
A base class for compressors used in compression and decompression of data.
Member Enumeration Documentation
The compression level.
- Enumerator:
| levelDefault |
The default compression level (equals 6 for deflate).
|
| levelStore |
No compression used. Data is stored.
|
| levelFastest |
The fastest compression. The compression ratio is the lowest (apart from levelStore).
|
| levelBest |
The highest compression ratio. It's usually the slowest one.
|
The compression method.
- Enumerator:
| methodStore |
A file is stored, not compressed.
|
| methodDeflate |
The deflate compression method.
|
| methodBzip2 |
The bzip2 compression method.
- See also:
- Compressing Data
|
| methodWinZipAes |
This value means that WinZip AES encryption is used. The original compression method is stored in a WinZip extra field. It is only an informational value - you cannot set it as a compression method. The ZipArchive Library handles this value internally.
- See also:
- Encryption Methods: How to Best Protect Your Data
|
The type of a compressor.
- Enumerator:
| typeDeflate |
Deflate compression (default in zip archives).
|
| typeBzip2 |
Bzip2 compression.
|
| typePPMd |
PPMd compression.
|
Constructor & Destructor Documentation
| CZipCompressor::CZipCompressor |
( |
CZipStorage * |
pStorage ) |
[inline, protected] |
Initializes a new instance of the CZipCompressor class.
- Parameters:
-
| pStorage | The current storage object. |
Member Function Documentation
| virtual bool CZipCompressor::CanProcess |
( |
WORD |
uMethod ) |
[pure virtual] |
| virtual void CZipCompressor::Compress |
( |
const void * |
pBuffer, |
|
|
DWORD |
uSize |
|
) |
| [pure virtual] |
| virtual int CZipCompressor::ConvertInternalError |
( |
int |
iErr ) |
const [inline, protected, virtual] |
A factory method that creates an appropriate compressor for the given compression method.
- Parameters:
-
| uMethod | The compression method to create a compressor for. It can be one of the CompressionMethod values. |
| pStorage | The current storage object. |
| virtual DWORD CZipCompressor::Decompress |
( |
void * |
pBuffer, |
|
|
DWORD |
uSize |
|
) |
| [pure virtual] |
| DWORD CZipCompressor::FillBuffer |
( |
) |
[inline, protected] |
Fills the read buffer.
- Returns:
- The number of bytes read.
| virtual void CZipCompressor::FinishCompression |
( |
bool |
bAfterException ) |
[inline, virtual] |
| virtual void CZipCompressor::FinishDecompression |
( |
bool |
bAfterException ) |
[inline, virtual] |
| void CZipCompressor::FlushWriteBuffer |
( |
) |
[inline, protected] |
Flushes data in the buffer into the storage, encrypting the data if needed.
| virtual const COptions* CZipCompressor::GetOptions |
( |
) |
const [inline, virtual] |
| void CZipCompressor::InitBuffer |
( |
) |
[protected] |
| static bool CZipCompressor::IsCompressionSupported |
( |
WORD |
uCompressionMethod ) |
[inline, static] |
Returns the value indicating whether the given compression method is supported by the ZipArchive Library.
- Parameters:
-
| uCompressionMethod | The compression method. It can be one of the CompressionMethod values. |
- Returns:
true, if the compression method is supported, false otherwise.
Prepares the compressor for the seeking operation.
- Parameters:
-
| pCurrentFile | The currently opened file. |
| pPair | The offsets pair describing the seek location. |
- See also:
- Creating Seekable Compressed Data
| void CZipCompressor::ReleaseBuffer |
( |
) |
[inline, protected] |
| void CZipCompressor::ThrowError |
( |
int |
iErr, |
|
|
bool |
bInternal = false |
|
) |
| [inline, protected] |
Throws an exception with a given error code.
- Parameters:
-
| iErr | An error code. |
| bInternal | true, if iErr is an internal error code and needs a conversion to the ZipArchive Library error code; false otherwise. |
- See also:
- ConvertInternalError
| void CZipCompressor::UpdateCrc |
( |
const void * |
pBuffer, |
|
|
DWORD |
uSize |
|
) |
| [protected] |
Updates CRC value while decompression.
- Parameters:
-
| pBuffer | A buffer with data for which the CRC value should be updated. |
| uSize | The size of the buffer. |
| void CZipCompressor::UpdateFileCrc |
( |
const void * |
pBuffer, |
|
|
DWORD |
uSize |
|
) |
| [protected] |
Updates CRC value while compression.
- Parameters:
-
| pBuffer | A buffer with data for which the CRC value should be updated. |
| uSize | The size of the buffer. |
| void CZipCompressor::UpdateOptions |
( |
const COptionsMap & |
optionsMap ) |
|
Updates the current options with the options stored in optionsMap, if the appropriate options are present in the map.
- Parameters:
-
| optionsMap | The map to get the new options from. |
- See also:
- Compressing Data
-
GetOptions
| virtual void CZipCompressor::UpdateOptions |
( |
const COptions * |
pOptions ) |
[inline, protected, virtual] |
| void CZipCompressor::WriteBuffer |
( |
char * |
pBuffer, |
|
|
DWORD |
uSize |
|
) |
| [inline, protected] |
Writes the buffer into the storage, encrypting the data if needed.
- Parameters:
-
| pBuffer | The buffer with data to write. |
| uSize | The size of the buffer. |
Member Data Documentation
A buffer that receives compressed data or provides data for decompression.
The file header being compressed or decompressed.
The current storage object.
The number of bytes left to compress.
The number of bytes left to decompress.
The documentation for this class was generated from the following file: