compressionlibs/ziplib/test/oldezlib/inc/OldEZDecompressor.h
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     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 "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.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 __EZLIB_EZDECOMPRESSOR_H__
       
    20 #define __EZLIB_EZDECOMPRESSOR_H__
       
    21 
       
    22 #include <e32base.h>
       
    23 #include "OldEZstream.h"
       
    24 #include "OldEZBufman.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 namespace TOLDEZLIB
       
    37 {
       
    38 	
       
    39 class CEZDecompressor : public CEZZStream
       
    40 	{
       
    41 public:
       
    42 	/** Decompression panic values */
       
    43 	enum 
       
    44 		{
       
    45 		EInflateInitlialiserError = EUnexpected + 1,
       
    46 		EInflateVersionError,
       
    47 		EInflateTerminated,
       
    48 		EInflateDictionaryError
       
    49 		};
       
    50 		
       
    51 	/** Window Bits - the base two logarithm of the window size (the size of the history buffer) */
       
    52 	enum
       
    53 		{
       
    54 		EMaxWBits = MAX_WBITS
       
    55 		};
       
    56 
       
    57 public:
       
    58 	~CEZDecompressor();
       
    59 
       
    60 	IMPORT_C static CEZDecompressor* NewLC(MEZBufferManager& aInit, TInt aWindowBits = EMaxWBits);
       
    61 	IMPORT_C static CEZDecompressor* NewL(MEZBufferManager& aInit, TInt aWindowBits = EMaxWBits);
       
    62 
       
    63 	IMPORT_C static CEZDecompressor* NewLC(MEZBufferManager& aInit, const TDesC8& aDictionary, TInt aWindowBits = EMaxWBits);
       
    64 	IMPORT_C static CEZDecompressor* NewL(MEZBufferManager& aInit, const TDesC8& aDictionary, TInt aWindowBits = EMaxWBits);
       
    65 
       
    66 
       
    67 	IMPORT_C void ResetL(MEZBufferManager& aInit);
       
    68 	IMPORT_C TBool InflateL();
       
    69 
       
    70 	IMPORT_C static void DecompressL(TDes8 &aDestination, const TDesC8 &aSource);
       
    71 
       
    72 	private:
       
    73 		enum TInflationState
       
    74 			{
       
    75 			ENoFlush,
       
    76 			EFinalize,
       
    77 			ETerminated
       
    78 			};
       
    79 
       
    80 	private:
       
    81 		void SetDictionaryL();
       
    82 		CEZDecompressor(MEZBufferManager* aInit);
       
    83 		CEZDecompressor(MEZBufferManager* aInit, const TUint8 *aDictionary, TInt aLength);
       
    84 		void ConstructL(TInt aWindowBits);
       
    85 
       
    86 	private:
       
    87 		MEZBufferManager* iBufferInit;
       
    88 		TInflationState iInflationState;
       
    89 		const TUint8* iDictionary;
       
    90 		TInt iDictionaryLength;
       
    91 	};
       
    92 
       
    93 } //namespace TOLDEZLIB
       
    94 #endif
       
    95 
       
    96