williamr@2
|
1 |
// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
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
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
// EZLib: DECOMPRESSOR.H
|
williamr@2
|
15 |
// Declaration for Decompression class
|
williamr@2
|
16 |
//
|
williamr@2
|
17 |
//
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#ifndef __EZDECOMPRESSOR_H__
|
williamr@2
|
20 |
#define __EZDECOMPRESSOR_H__
|
williamr@2
|
21 |
|
williamr@2
|
22 |
#include <e32base.h>
|
williamr@2
|
23 |
#include <ezstream.h>
|
williamr@2
|
24 |
#include <ezbufman.h>
|
williamr@2
|
25 |
|
williamr@2
|
26 |
/**
|
williamr@2
|
27 |
The CEZDecompressor class provides in-memory de-compression functions, including integrity checks of the compressed data.
|
williamr@2
|
28 |
This version of the library supports only one compression / de-compression method (deflation / inflation). De-compression
|
williamr@2
|
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),
|
williamr@2
|
30 |
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
|
31 |
and target contained within the buffer manager argument).
|
williamr@2
|
32 |
|
williamr@2
|
33 |
@publishedAll
|
williamr@2
|
34 |
@released
|
williamr@2
|
35 |
*/
|
williamr@2
|
36 |
class CEZDecompressor : public CEZZStream
|
williamr@2
|
37 |
{
|
williamr@2
|
38 |
public:
|
williamr@2
|
39 |
/** Decompression panic values */
|
williamr@2
|
40 |
enum
|
williamr@2
|
41 |
{
|
williamr@2
|
42 |
EInflateInitlialiserError = EUnexpected + 1,
|
williamr@2
|
43 |
EInflateVersionError,
|
williamr@2
|
44 |
EInflateTerminated,
|
williamr@2
|
45 |
EInflateDictionaryError
|
williamr@2
|
46 |
};
|
williamr@2
|
47 |
|
williamr@2
|
48 |
/** Window Bits - the base two logarithm of the window size (the size of the history buffer) */
|
williamr@2
|
49 |
enum
|
williamr@2
|
50 |
{
|
williamr@2
|
51 |
EMaxWBits = MAX_WBITS
|
williamr@2
|
52 |
};
|
williamr@2
|
53 |
|
williamr@2
|
54 |
public:
|
williamr@2
|
55 |
~CEZDecompressor();
|
williamr@2
|
56 |
|
williamr@2
|
57 |
IMPORT_C static CEZDecompressor* NewLC(MEZBufferManager& aInit, TInt aWindowBits = EMaxWBits);
|
williamr@2
|
58 |
IMPORT_C static CEZDecompressor* NewL(MEZBufferManager& aInit, TInt aWindowBits = EMaxWBits);
|
williamr@2
|
59 |
|
williamr@2
|
60 |
IMPORT_C static CEZDecompressor* NewLC(MEZBufferManager& aInit, const TDesC8& aDictionary, TInt aWindowBits = EMaxWBits);
|
williamr@2
|
61 |
IMPORT_C static CEZDecompressor* NewL(MEZBufferManager& aInit, const TDesC8& aDictionary, TInt aWindowBits = EMaxWBits);
|
williamr@2
|
62 |
|
williamr@2
|
63 |
|
williamr@2
|
64 |
IMPORT_C void ResetL(MEZBufferManager& aInit);
|
williamr@2
|
65 |
IMPORT_C TBool InflateL();
|
williamr@2
|
66 |
|
williamr@2
|
67 |
IMPORT_C static void DecompressL(TDes8 &aDestination, const TDesC8 &aSource);
|
williamr@2
|
68 |
|
williamr@2
|
69 |
private:
|
williamr@2
|
70 |
enum TInflationState
|
williamr@2
|
71 |
{
|
williamr@2
|
72 |
ENoFlush,
|
williamr@2
|
73 |
EFinalize,
|
williamr@2
|
74 |
ETerminated
|
williamr@2
|
75 |
};
|
williamr@2
|
76 |
|
williamr@2
|
77 |
private:
|
williamr@2
|
78 |
void SetDictionaryL();
|
williamr@2
|
79 |
CEZDecompressor(MEZBufferManager* aInit);
|
williamr@2
|
80 |
CEZDecompressor(MEZBufferManager* aInit, const TUint8 *aDictionary, TInt aLength);
|
williamr@2
|
81 |
void ConstructL(TInt aWindowBits);
|
williamr@2
|
82 |
|
williamr@2
|
83 |
private:
|
williamr@2
|
84 |
MEZBufferManager* iBufferInit;
|
williamr@2
|
85 |
TInflationState iInflationState;
|
williamr@2
|
86 |
const TUint8* iDictionary;
|
williamr@2
|
87 |
TInt iDictionaryLength;
|
williamr@2
|
88 |
};
|
williamr@2
|
89 |
|
williamr@2
|
90 |
#endif
|