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