1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/compressionlibs/ziplib/inc/ezdecompressor.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,98 @@
1.4 +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Declaration for Decompression class
1.18 +//
1.19 +//
1.20 +
1.21 +#ifndef __EZDECOMPRESSOR_H__
1.22 +#define __EZDECOMPRESSOR_H__
1.23 +
1.24 +#include <e32base.h>
1.25 +#include <ezstream.h>
1.26 +#include <ezbufman.h>
1.27 +
1.28 +/**
1.29 +The CEZDecompressor class provides in-memory de-compression functions, including integrity checks of the compressed data.
1.30 +This version of the library supports only one compression / de-compression method (deflation / inflation). De-compression
1.31 +can be done in a single step (using DecompressL()) if the buffers are large enough (for example if an input file is mmap'ed),
1.32 +or can be done by repeated calls of the InflateL() function. The source data is de-compressed to the target buffer (both source
1.33 +and target contained within the buffer manager argument).
1.34 +
1.35 +Note: In this version of the library a windowBits value of 8 is unsupported due to a problem with the window size being
1.36 +set to 256 bytes. Although a value of 8 will be accepted by the CEZCompressor constructors, as it is being changed
1.37 +internally by Zlib from 8 to 9, it will not be possible to use the same value for decompression. This is because the
1.38 +Zlib functions called by the CEZDecompressor constructors do not make the same change internally and as a result a
1.39 +KEZlibErrData is returned when calling InflateL(). It is therefore advised that for this version of the library
1.40 +windowBits of 9 is used in place of 8.
1.41 +
1.42 +@publishedAll
1.43 +@released
1.44 +*/
1.45 +class CEZDecompressor : public CEZZStream
1.46 + {
1.47 +public:
1.48 + /** Decompression panic values */
1.49 + enum
1.50 + {
1.51 + EInflateInitlialiserError = EUnexpected + 1,
1.52 + EInflateVersionError,
1.53 + EInflateTerminated,
1.54 + EInflateDictionaryError
1.55 + };
1.56 +
1.57 + /** Window Bits - the base two logarithm of the window size (the size of the history buffer) */
1.58 + enum
1.59 + {
1.60 + EMaxWBits = MAX_WBITS
1.61 + };
1.62 +
1.63 +public:
1.64 + ~CEZDecompressor();
1.65 +
1.66 + IMPORT_C static CEZDecompressor* NewLC(MEZBufferManager& aInit, TInt aWindowBits = EMaxWBits);
1.67 + IMPORT_C static CEZDecompressor* NewL(MEZBufferManager& aInit, TInt aWindowBits = EMaxWBits);
1.68 +
1.69 + IMPORT_C static CEZDecompressor* NewLC(MEZBufferManager& aInit, const TDesC8& aDictionary, TInt aWindowBits = EMaxWBits);
1.70 + IMPORT_C static CEZDecompressor* NewL(MEZBufferManager& aInit, const TDesC8& aDictionary, TInt aWindowBits = EMaxWBits);
1.71 +
1.72 +
1.73 + IMPORT_C void ResetL(MEZBufferManager& aInit);
1.74 + IMPORT_C TBool InflateL();
1.75 +
1.76 + IMPORT_C static void DecompressL(TDes8 &aDestination, const TDesC8 &aSource);
1.77 +
1.78 + private:
1.79 + enum TInflationState
1.80 + {
1.81 + ENoFlush,
1.82 + EFinalize,
1.83 + ETerminated
1.84 + };
1.85 +
1.86 + private:
1.87 + void SetDictionaryL();
1.88 + CEZDecompressor(MEZBufferManager* aInit);
1.89 + CEZDecompressor(MEZBufferManager* aInit, const TUint8 *aDictionary, TInt aLength);
1.90 + void ConstructL(TInt aWindowBits);
1.91 +
1.92 + private:
1.93 + MEZBufferManager* iBufferInit;
1.94 + TInflationState iInflationState;
1.95 + const TUint8* iDictionary;
1.96 + TInt iDictionaryLength;
1.97 + };
1.98 +
1.99 +#endif
1.100 +
1.101 +