author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
parent 2 | 2fe1408b6811 |
permissions | -rw-r--r-- |
2
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
1 |
// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
2 |
// All rights reserved. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
3 |
// This component and the accompanying materials are made available |
4
837f303aceeb
Current Symbian^3 public API header files (from PDK 3.0.h)
William Roberts <williamr@symbian.org>
parents:
2
diff
changeset
|
4 |
// under the terms of "Eclipse Public License v1.0" |
2
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
5 |
// which accompanies this distribution, and is available |
4
837f303aceeb
Current Symbian^3 public API header files (from PDK 3.0.h)
William Roberts <williamr@symbian.org>
parents:
2
diff
changeset
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
2
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
7 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
8 |
// Initial Contributors: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
9 |
// Nokia Corporation - initial contribution. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
10 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
11 |
// Contributors: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
12 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
13 |
// Description: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
14 |
// Declaration for Compression class |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
15 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
16 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
17 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
18 |
#ifndef __EZCOMPRESSOR_H__ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
19 |
#define __EZCOMPRESSOR_H__ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
20 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
21 |
#include <e32base.h> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
22 |
#include <ezstream.h> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
23 |
#include <ezbufman.h> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
24 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
25 |
/** |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
26 |
The CEZCompressor class provides in-memory compression functions, including integrity checks of the uncompressed data. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
27 |
This version of the library supports only one compression method (deflation). Compression can be done in a single step |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
28 |
(using CompressL()) if the buffers are large enough (for example if an input file is mmap'ed), or can be done by repeated calls |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
29 |
of the DeflateL() function. The source data is compressed to the target buffer (both source and target contained within |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
30 |
the buffer manager argument), and various other arguments distinguish the different compression settings. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
31 |
|
4
837f303aceeb
Current Symbian^3 public API header files (from PDK 3.0.h)
William Roberts <williamr@symbian.org>
parents:
2
diff
changeset
|
32 |
Note: In this version of the library a windowBits value of 8 is unsupported due to a problem with the window size being |
837f303aceeb
Current Symbian^3 public API header files (from PDK 3.0.h)
William Roberts <williamr@symbian.org>
parents:
2
diff
changeset
|
33 |
set to 256 bytes. Although a value of 8 will be accepted by the CEZCompressor constructors, as it is being changed |
837f303aceeb
Current Symbian^3 public API header files (from PDK 3.0.h)
William Roberts <williamr@symbian.org>
parents:
2
diff
changeset
|
34 |
internally by Zlib from 8 to 9, it will not be possible to use the same value for decompression. This is because the |
837f303aceeb
Current Symbian^3 public API header files (from PDK 3.0.h)
William Roberts <williamr@symbian.org>
parents:
2
diff
changeset
|
35 |
Zlib functions called by the CEZDecompressor constructors do not make the same change internally and as a result a |
837f303aceeb
Current Symbian^3 public API header files (from PDK 3.0.h)
William Roberts <williamr@symbian.org>
parents:
2
diff
changeset
|
36 |
KEZlibErrData is returned when calling InflateL(). It is therefore advised that for this version of the library |
837f303aceeb
Current Symbian^3 public API header files (from PDK 3.0.h)
William Roberts <williamr@symbian.org>
parents:
2
diff
changeset
|
37 |
windowBits of 9 is used in place of 8. |
837f303aceeb
Current Symbian^3 public API header files (from PDK 3.0.h)
William Roberts <williamr@symbian.org>
parents:
2
diff
changeset
|
38 |
|
2
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
39 |
@publishedAll |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
40 |
@released |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
41 |
*/ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
42 |
class CEZCompressor : public CEZZStream |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
43 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
44 |
public: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
45 |
/** Compression strategy - used to tune the compression algorithm */ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
46 |
enum TStrategy |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
47 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
48 |
/** Use for normal data */ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
49 |
EDefaultStrategy = Z_DEFAULT_STRATEGY, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
50 |
|
4
837f303aceeb
Current Symbian^3 public API header files (from PDK 3.0.h)
William Roberts <williamr@symbian.org>
parents:
2
diff
changeset
|
51 |
/** Use for data produced by a filter (or predictor) */ |
2
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
52 |
EFiltered = Z_FILTERED, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
53 |
|
4
837f303aceeb
Current Symbian^3 public API header files (from PDK 3.0.h)
William Roberts <williamr@symbian.org>
parents:
2
diff
changeset
|
54 |
/** Force Huffman encoding only (no string match) */ |
2
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
55 |
EHuffmanOnly = Z_HUFFMAN_ONLY |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
56 |
}; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
57 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
58 |
/** Compression levels */ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
59 |
enum |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
60 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
61 |
EDefaultCompression = Z_DEFAULT_COMPRESSION, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
62 |
ENoCompression = Z_NO_COMPRESSION, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
63 |
EBestSpeed = Z_BEST_SPEED, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
64 |
EBestCompression = Z_BEST_COMPRESSION |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
65 |
}; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
66 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
67 |
/** Window Bits - the base two logarithm of the window size (the size of the history buffer) */ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
68 |
enum |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
69 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
70 |
EMaxWBits = MAX_WBITS |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
71 |
}; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
72 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
73 |
/** Memory level - specifies how much memory should be allocated for the internal compression state */ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
74 |
enum |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
75 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
76 |
EDefMemLevel = MAX_MEM_LEVEL |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
77 |
}; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
78 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
79 |
/** Compression panic values */ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
80 |
enum |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
81 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
82 |
EDeflateInitlialiserError = EUnexpected + 1, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
83 |
EDeflateTerminated |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
84 |
}; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
85 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
86 |
public: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
87 |
~CEZCompressor(); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
88 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
89 |
IMPORT_C static CEZCompressor* NewLC(MEZBufferManager& aInit, TInt aLevel = EDefaultCompression, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
90 |
TInt aWindowBits = EMaxWBits, TInt aMemLevel = EDefMemLevel, TStrategy aStrategy = EDefaultStrategy); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
91 |
IMPORT_C static CEZCompressor* NewL(MEZBufferManager& aInit, TInt aLevel = EDefaultCompression, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
92 |
TInt aWindowBits = EMaxWBits, TInt aMemLevel = EDefMemLevel, TStrategy aStrategy = EDefaultStrategy); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
93 |
IMPORT_C static CEZCompressor* NewLC(MEZBufferManager& aInit, const TDesC8 &aDictionary, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
94 |
TInt aLevel = EDefaultCompression, TInt aWindowBits = EMaxWBits, TInt aMemLevel = EDefMemLevel, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
95 |
TStrategy aStrategy = EDefaultStrategy); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
96 |
IMPORT_C static CEZCompressor* NewL(MEZBufferManager& aInit, const TDesC8 &aDictionary, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
97 |
TInt aLevel = EDefaultCompression, TInt aWindowBits = EMaxWBits, TInt aMemLevel = EDefMemLevel, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
98 |
TStrategy aStrategy = EDefaultStrategy); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
99 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
100 |
IMPORT_C void ResetL(MEZBufferManager& aInit); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
101 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
102 |
IMPORT_C TBool DeflateL(); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
103 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
104 |
IMPORT_C static void CompressL(TDes8 &aDestination, const TDesC8 &aSource, TInt aLevel = EDefaultCompression); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
105 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
106 |
private: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
107 |
enum TDeflationState |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
108 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
109 |
ENoFlush, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
110 |
EFinish, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
111 |
EFinalize, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
112 |
ETerminated |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
113 |
}; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
114 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
115 |
private: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
116 |
CEZCompressor(MEZBufferManager* aInit); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
117 |
void ConstructL(TInt aLevel, const TUint8* aDictionary, TInt aLength, TInt aWindowBits, TInt aMemLevel, TStrategy aStrategy); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
118 |
void ConstructL(TInt aLevel, TInt aWindowBits, TInt aMemLevel, TStrategy aStrategy); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
119 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
120 |
private: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
121 |
MEZBufferManager* iBufferInit; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
122 |
TDeflationState iDeflationState; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
123 |
}; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
124 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
0
diff
changeset
|
125 |
#endif |
4
837f303aceeb
Current Symbian^3 public API header files (from PDK 3.0.h)
William Roberts <williamr@symbian.org>
parents:
2
diff
changeset
|
126 |
|
837f303aceeb
Current Symbian^3 public API header files (from PDK 3.0.h)
William Roberts <williamr@symbian.org>
parents:
2
diff
changeset
|
127 |