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