view src/win32/7zip/7z/CPP/7zip/Archive/GZip/GZipItem.h @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line source
1 // Archive/GZipItem.h
3 #ifndef __ARCHIVE_GZIP_ITEM_H
4 #define __ARCHIVE_GZIP_ITEM_H
6 #include "Common/Types.h"
7 #include "Common/MyString.h"
8 #include "Common/Buffer.h"
10 namespace NArchive {
11 namespace NGZip {
13 class CItem
14 {
15 private:
16 bool TestFlag(Byte flag) const { return ((Flags & flag) != 0); }
17 public:
18 Byte CompressionMethod;
19 Byte Flags;
20 UInt32 Time;
21 Byte ExtraFlags;
22 Byte HostOS;
23 UInt32 FileCRC;
24 UInt32 UnPackSize32;
26 AString Name;
27 AString Comment;
28 CByteBuffer Extra;
30 bool IsText() const
31 { return TestFlag(NFileHeader::NFlags::kDataIsText); }
32 bool HeaderCRCIsPresent() const
33 { return TestFlag(NFileHeader::NFlags::kHeaderCRCIsPresent); }
34 bool ExtraFieldIsPresent() const
35 { return TestFlag(NFileHeader::NFlags::kExtraIsPresent); }
36 bool NameIsPresent() const
37 { return TestFlag(NFileHeader::NFlags::kNameIsPresent); }
38 bool CommentIsPresent() const
39 { return TestFlag(NFileHeader::NFlags::kComentIsPresent); }
41 void SetNameIsPresentFlag(bool nameIsPresent)
42 {
43 if (nameIsPresent)
44 Flags |= NFileHeader::NFlags::kNameIsPresent;
45 else
46 Flags &= (~NFileHeader::NFlags::kNameIsPresent);
47 }
49 void Clear()
50 {
51 Name.Empty();
52 Comment.Empty();;
53 Extra.SetCapacity(0);
54 }
55 };
57 }}
59 #endif