Welcome to mirror list, hosted at ThFree Co, Russian Federation.

GZipItem.h « GZip « Archive « 7zip « CPP - github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cd5e59f06ab3ee218d774ac9bd0adf8d635838d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Archive/GZipItem.h

#ifndef __ARCHIVE_GZIP_ITEM_H
#define __ARCHIVE_GZIP_ITEM_H

#include "Common/Types.h"
#include "Common/MyString.h"
#include "Common/Buffer.h"

namespace NArchive {
namespace NGZip {

class CItem
{
private:
  bool TestFlag(Byte flag) const { return ((Flags & flag) != 0); }
public:
  Byte CompressionMethod;
  Byte Flags;
  UInt32 Time;
  Byte ExtraFlags;
  Byte HostOS;
  UInt32 FileCRC;
  UInt32 UnPackSize32;

  AString Name;
  AString Comment;
  CByteBuffer Extra;

  bool IsText() const
    {  return TestFlag(NFileHeader::NFlags::kDataIsText); }
  bool HeaderCRCIsPresent() const
    {  return TestFlag(NFileHeader::NFlags::kHeaderCRCIsPresent); }
  bool ExtraFieldIsPresent() const
    {  return TestFlag(NFileHeader::NFlags::kExtraIsPresent); }
  bool NameIsPresent() const
    {  return TestFlag(NFileHeader::NFlags::kNameIsPresent); }
  bool CommentIsPresent() const
    {  return TestFlag(NFileHeader::NFlags::kComentIsPresent); }

  void SetNameIsPresentFlag(bool nameIsPresent)
  {    
    if (nameIsPresent)
      Flags |= NFileHeader::NFlags::kNameIsPresent;
    else
      Flags &= (~NFileHeader::NFlags::kNameIsPresent);
  }

  void Clear()
  {
    Name.Empty();
    Comment.Empty();;
    Extra.SetCapacity(0);
  }
};

}}

#endif