williamr@2: // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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 williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // EZLib: DECOMPRESSOR.H williamr@2: // Declaration for Decompression class williamr@2: // williamr@2: // williamr@2: williamr@2: #ifndef __EZDECOMPRESSOR_H__ williamr@2: #define __EZDECOMPRESSOR_H__ williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: /** williamr@2: The CEZDecompressor class provides in-memory de-compression functions, including integrity checks of the compressed data. williamr@2: This version of the library supports only one compression / de-compression method (deflation / inflation). De-compression williamr@2: can be done in a single step (using DecompressL()) if the buffers are large enough (for example if an input file is mmap'ed), williamr@2: or can be done by repeated calls of the InflateL() function. The source data is de-compressed to the target buffer (both source williamr@2: and target contained within the buffer manager argument). williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class CEZDecompressor : public CEZZStream williamr@2: { williamr@2: public: williamr@2: /** Decompression panic values */ williamr@2: enum williamr@2: { williamr@2: EInflateInitlialiserError = EUnexpected + 1, williamr@2: EInflateVersionError, williamr@2: EInflateTerminated, williamr@2: EInflateDictionaryError williamr@2: }; williamr@2: williamr@2: /** Window Bits - the base two logarithm of the window size (the size of the history buffer) */ williamr@2: enum williamr@2: { williamr@2: EMaxWBits = MAX_WBITS williamr@2: }; williamr@2: williamr@2: public: williamr@2: ~CEZDecompressor(); williamr@2: williamr@2: IMPORT_C static CEZDecompressor* NewLC(MEZBufferManager& aInit, TInt aWindowBits = EMaxWBits); williamr@2: IMPORT_C static CEZDecompressor* NewL(MEZBufferManager& aInit, TInt aWindowBits = EMaxWBits); williamr@2: williamr@2: IMPORT_C static CEZDecompressor* NewLC(MEZBufferManager& aInit, const TDesC8& aDictionary, TInt aWindowBits = EMaxWBits); williamr@2: IMPORT_C static CEZDecompressor* NewL(MEZBufferManager& aInit, const TDesC8& aDictionary, TInt aWindowBits = EMaxWBits); williamr@2: williamr@2: williamr@2: IMPORT_C void ResetL(MEZBufferManager& aInit); williamr@2: IMPORT_C TBool InflateL(); williamr@2: williamr@2: IMPORT_C static void DecompressL(TDes8 &aDestination, const TDesC8 &aSource); williamr@2: williamr@2: private: williamr@2: enum TInflationState williamr@2: { williamr@2: ENoFlush, williamr@2: EFinalize, williamr@2: ETerminated williamr@2: }; williamr@2: williamr@2: private: williamr@2: void SetDictionaryL(); williamr@2: CEZDecompressor(MEZBufferManager* aInit); williamr@2: CEZDecompressor(MEZBufferManager* aInit, const TUint8 *aDictionary, TInt aLength); williamr@2: void ConstructL(TInt aWindowBits); williamr@2: williamr@2: private: williamr@2: MEZBufferManager* iBufferInit; williamr@2: TInflationState iInflationState; williamr@2: const TUint8* iDictionary; williamr@2: TInt iDictionaryLength; williamr@2: }; williamr@2: williamr@2: #endif