|
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 // Declaration for CEZStream class. |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __EZZSTREAM_H__ |
|
19 #define __EZZSTREAM_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <ezlib.h> |
|
23 #include <ezliberrorcodes.h> |
|
24 |
|
25 /** |
|
26 Represents a zip stream |
|
27 |
|
28 @publishedAll |
|
29 @released |
|
30 */ |
|
31 class CEZZStream : public CBase |
|
32 { |
|
33 public: |
|
34 /** stream panic values */ |
|
35 enum |
|
36 { |
|
37 EStreamError = -Z_STREAM_ERROR, |
|
38 EDataError = -Z_DATA_ERROR, |
|
39 EBufError = -Z_BUF_ERROR, |
|
40 EVersionError = -Z_VERSION_ERROR, |
|
41 EUnexpected |
|
42 }; |
|
43 public: |
|
44 IMPORT_C void SetInput(const TDesC8& aInputData); |
|
45 IMPORT_C void SetOutput(TDes8& aOutputData); |
|
46 |
|
47 IMPORT_C TPtrC8 OutputDescriptor() const; |
|
48 IMPORT_C TInt TotalOut() const; |
|
49 IMPORT_C TInt TotalIn() const; |
|
50 IMPORT_C TInt32 Adler32() const; |
|
51 IMPORT_C TInt AvailIn() const; |
|
52 IMPORT_C TInt AvailOut() const; |
|
53 |
|
54 IMPORT_C TInt Progress(TInt aTotalLength) const; |
|
55 |
|
56 protected: |
|
57 CEZZStream(); |
|
58 |
|
59 |
|
60 protected: |
|
61 z_stream iStream; |
|
62 |
|
63 // This pointer is reset every time SetOutput is called. It maintains a pointer to the |
|
64 // start of the output buffer which is being written to. We cannot use iStream.next_out, |
|
65 // because zlib will modifify this during its deflate and inflate. |
|
66 |
|
67 TUint8* iOutputPointer; |
|
68 TInt iOutputBufferLength; |
|
69 }; |
|
70 |
|
71 #endif |