epoc32/include/ziparchive.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 ziparchive.h
     1 // Copyright (c) 2003-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // $Revision: 1.1 $
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef _ZIP_ARCHIVE_H_
       
    19 #define _ZIP_ARCHIVE_H_
       
    20 
       
    21 #include "localtypes.h"
       
    22 
       
    23 /**
       
    24 This class represents a zip archive
       
    25 
       
    26 @publishedAll
       
    27 @released
       
    28 */
       
    29 class CZipArchive: public CBase
       
    30 	{
       
    31 public:
       
    32 
       
    33     enum 
       
    34 		{	
       
    35 		KZipArchiveError 					= -256,
       
    36 	    KCentralDirectoryTrailerNotFound	= KZipArchiveError - 1,
       
    37 	    KCentralDirectoryTrailerInvalid		= KZipArchiveError - 3,
       
    38 	    KCompressionMethodNotSupported		= KZipArchiveError - 4,
       
    39 	    KLocalHeaderSignatureInvalid		= KZipArchiveError - 5,
       
    40 	    KMultiDiskArchivesNotSupported		= KZipArchiveError - 6,
       
    41 		KMemberNotFound						= KZipArchiveError - 7,
       
    42 
       
    43 		KZipArchiveMinError					= KZipArchiveError - 8
       
    44 
       
    45 		};
       
    46     
       
    47     enum TCompressionMethod 
       
    48 		{
       
    49 		
       
    50 		EStored 		= 0,
       
    51 		EShrunk 		= 1,
       
    52 		EReducedCFOne	= 2,
       
    53 		EReducedCFTwo	= 3,
       
    54 		EReducedCFThree	= 4,
       
    55 		EReducedCFFour	= 5,
       
    56 		EImploded		= 6,
       
    57 		EReservedOne	= 7,
       
    58 		EDeflated		= 8,
       
    59 		EReservedTwo	= 9,
       
    60 		EPKWAREImploded	= 10
       
    61 		
       
    62 		};
       
    63 
       
    64 protected:
       
    65 
       
    66     enum // Constants 
       
    67 		{
       
    68     
       
    69         KCentralDirectorySignature  		= 0x06054b50,
       
    70     	KCentralDirectoryHeaderSignature	= 0x02014b50,
       
    71     	KLocalHeaderSignature   			= 0x04034b50
       
    72 		};
       
    73 	
       
    74 	enum // Lengths 
       
    75 		{
       
    76 	
       
    77 		KCentralDirectoryTrailerFixedLength = 22,
       
    78 		KLocalHeaderFixedLength             = 30,
       
    79 		KCentralDirectoryHeaderFixedLength	= 46,
       
    80 		KSignatureLength                    =  4,
       
    81 		KMaxTrailerSearchLength             = 65536
       
    82 		};
       
    83 	
       
    84 	enum // Offsets 
       
    85 		{
       
    86 	
       
    87 		KCentralFileHeaderFileNameLengthOffset   = 28,
       
    88 		KCentralFileHeaderExtraFieldLengthOffset = 30,
       
    89 		KCentralFileHeaderFileNameOffset         = 46
       
    90 		};
       
    91 	
       
    92 	/**
       
    93 	Represents the archive's central directory trailer - the central directory contains information
       
    94 	about files in the arhive
       
    95 
       
    96 	@publishedAll
       
    97 	@released
       
    98 	*/
       
    99     struct TCentralDirectoryTrailer 
       
   100 		{
       
   101         TUint32 iSignature;
       
   102 		TUint16 iDiskNumber;
       
   103 		TUint16 iStartDiskNumber;
       
   104 		TUint16 iLocalEntryCount;
       
   105 		TUint16 iTotalEntryCount;
       
   106 		TUint32 iSize;
       
   107 		TUint32 iOffset;
       
   108 		TUint16 iCommentLength;
       
   109 		// comment -- variable length
       
   110 		};
       
   111 
       
   112 	/**
       
   113 	Represents the archive's central directory header - the central directory contains information
       
   114 	about files in the arhive
       
   115 
       
   116 	@publishedAll
       
   117 	@released
       
   118 	*/
       
   119 	struct TCentralDirectoryHeader 
       
   120 		{
       
   121 		TUint32 iSignature;
       
   122 		TUint16 iMadeBy;
       
   123 		TUint16 iRequired;
       
   124 		TUint16 iFlags;
       
   125 		TUint16 iCompressionMethod;
       
   126 		TUint16 iLastModifiedFileTime;
       
   127 		TUint16 iLastModifiedFileDate;
       
   128 		TUint32 iCRC32;
       
   129 		TUint32 iCompressedSize;
       
   130 		TUint32 iUncompressedSize;
       
   131 		TUint16 iFileNameLength;
       
   132 		TUint16 iExtraFieldLength;
       
   133 		TUint16 iFileCommentLength;
       
   134 		TUint16 iDiskNumberStart;
       
   135 		TUint16 iInternalFileAttributes;
       
   136 		TUint32 iExternalFileAttributes;
       
   137 		TUint32 iLocalHeaderOffset;
       
   138 		// file name    -- variable length 
       
   139 		// extra field  -- variable length
       
   140 		// file comment -- variable length
       
   141 		};
       
   142 
       
   143 	/**
       
   144 	Represents the archive's local header
       
   145 
       
   146 	@publishedAll
       
   147 	@released
       
   148 	*/
       
   149 	struct TLocalHeader 
       
   150 		{
       
   151 		TUint32 iSignature;
       
   152 		TUint16 iVersionNeeded;
       
   153 		TUint16 iFlags;
       
   154 		TUint16 iCompressionMethod;
       
   155 		TUint16 iLastModifiedFileTime;
       
   156 		TUint16 iLastModifiedFileDate;
       
   157 		TUint32 iCRC32;
       
   158 		TUint32 iCompressedSize;
       
   159 		TUint32 iUncompressedSize;
       
   160 		TUint16 iFileNameLength;
       
   161 		TUint16 iExtraFieldLength;
       
   162 		// file name    -- variable length 
       
   163 		// extra field  -- variable length
       
   164 		};
       
   165 	};
       
   166 
       
   167 #endif /* !_ZIP_ARCHIVE_H_ */