epoc32/include/ezdecompressor.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // EZLib: DECOMPRESSOR.H
    15 // Declaration for Decompression class
    16 // 
    17 //
    18 
    19 #ifndef __EZDECOMPRESSOR_H__
    20 #define __EZDECOMPRESSOR_H__
    21 
    22 #include <e32base.h>
    23 #include <ezstream.h>
    24 #include <ezbufman.h>
    25 
    26 /**
    27 The CEZDecompressor class provides in-memory de-compression functions, including integrity checks of the compressed data.
    28 This version of the library supports only one compression / de-compression method (deflation / inflation).  De-compression
    29 can be done in a single step (using DecompressL()) if the buffers are large enough (for example if an input file is mmap'ed),
    30 or can be done by repeated calls of the InflateL() function.  The source data is de-compressed to the target buffer (both source 
    31 and target contained within the buffer manager argument).
    32 
    33 @publishedAll
    34 @released
    35 */
    36 class CEZDecompressor : public CEZZStream
    37 	{
    38 public:
    39 	/** Decompression panic values */
    40 	enum 
    41 		{
    42 		EInflateInitlialiserError = EUnexpected + 1,
    43 		EInflateVersionError,
    44 		EInflateTerminated,
    45 		EInflateDictionaryError
    46 		};
    47 		
    48 	/** Window Bits - the base two logarithm of the window size (the size of the history buffer) */
    49 	enum
    50 		{
    51 		EMaxWBits = MAX_WBITS
    52 		};
    53 
    54 public:
    55 	~CEZDecompressor();
    56 
    57 	IMPORT_C static CEZDecompressor* NewLC(MEZBufferManager& aInit, TInt aWindowBits = EMaxWBits);
    58 	IMPORT_C static CEZDecompressor* NewL(MEZBufferManager& aInit, TInt aWindowBits = EMaxWBits);
    59 
    60 	IMPORT_C static CEZDecompressor* NewLC(MEZBufferManager& aInit, const TDesC8& aDictionary, TInt aWindowBits = EMaxWBits);
    61 	IMPORT_C static CEZDecompressor* NewL(MEZBufferManager& aInit, const TDesC8& aDictionary, TInt aWindowBits = EMaxWBits);
    62 
    63 
    64 	IMPORT_C void ResetL(MEZBufferManager& aInit);
    65 	IMPORT_C TBool InflateL();
    66 
    67 	IMPORT_C static void DecompressL(TDes8 &aDestination, const TDesC8 &aSource);
    68 
    69 	private:
    70 		enum TInflationState
    71 			{
    72 			ENoFlush,
    73 			EFinalize,
    74 			ETerminated
    75 			};
    76 
    77 	private:
    78 		void SetDictionaryL();
    79 		CEZDecompressor(MEZBufferManager* aInit);
    80 		CEZDecompressor(MEZBufferManager* aInit, const TUint8 *aDictionary, TInt aLength);
    81 		void ConstructL(TInt aWindowBits);
    82 
    83 	private:
    84 		MEZBufferManager* iBufferInit;
    85 		TInflationState iInflationState;
    86 		const TUint8* iDictionary;
    87 		TInt iDictionaryLength;
    88 	};
    89 
    90 #endif