This commit is contained in:
Igor Pavlov
2005-05-30 00:00:00 +00:00
committed by Kornel Lesiński
parent 8c1b5c7b7e
commit 3c510ba80b
926 changed files with 40559 additions and 23519 deletions

View File

@@ -1,45 +1,67 @@
// Archive/ZipItem.h
#pragma once
#ifndef __ARCHIVE_ZIP_ITEM_H
#define __ARCHIVE_ZIP_ITEM_H
#include "Common/Types.h"
#include "Common/String.h"
#include "Common/Buffer.h"
#include "ZipHeader.h"
namespace NArchive {
namespace NZip {
struct CVersion
{
BYTE Version;
BYTE HostOS;
Byte Version;
Byte HostOS;
};
bool operator==(const CVersion &v1, const CVersion &v2);
bool operator!=(const CVersion &v1, const CVersion &v2);
struct CExtraSubBlock
{
UInt16 ID;
CByteBuffer Data;
};
struct CExtraBlock
{
CObjectVector<CExtraSubBlock> SubBlocks;
void Clear() { SubBlocks.Clear(); }
UInt32 GetSize() const
{
UInt32 res = 0;
for (int i = 0; i < SubBlocks.Size(); i++)
res += SubBlocks[i].Data.GetCapacity() + 2 + 2;
return res;
}
};
class CItem
{
public:
CVersion MadeByVersion;
CVersion ExtractVersion;
UINT16 Flags;
UINT16 CompressionMethod;
UINT32 Time;
UINT32 FileCRC;
UINT32 PackSize;
UINT32 UnPackSize;
UINT16 InternalAttributes;
UINT32 ExternalAttributes;
UInt16 Flags;
UInt16 CompressionMethod;
UInt32 Time;
UInt32 FileCRC;
UInt64 PackSize;
UInt64 UnPackSize;
UInt16 InternalAttributes;
UInt32 ExternalAttributes;
AString Name;
UINT32 LocalHeaderPosition;
UINT16 LocalExtraSize;
UINT16 CentralExtraSize;
UINT16 CommentSize;
UInt64 LocalHeaderPosition;
UInt16 LocalExtraSize;
CExtraBlock CentralExtra;
CByteBuffer Comment;
bool IsEncrypted() const;
@@ -48,14 +70,16 @@ public:
bool IsDirectory() const;
bool IgnoreItem() const { return false; }
UINT32 GetWinAttributes() const;
UInt32 GetWinAttributes() const;
bool HasDescriptor() const;
#ifdef WIN32
WORD GetCodePage() const
{ return (MadeByVersion.HostOS == NFileHeader::NHostOS::kFAT) ? CP_OEMCP : CP_ACP; }
#endif
{
return (MadeByVersion.HostOS == NFileHeader::NHostOS::kFAT
|| MadeByVersion.HostOS == NFileHeader::NHostOS::kNTFS
) ? CP_OEMCP : CP_ACP;
}
private:
void SetFlagBits(int startBitNumber, int numBits, int value);