summaryrefslogtreecommitdiffstats
path: root/other-licenses/7zstub/src/7zip/UI/Common/ArchiverInfo.h
blob: 8c42f7c5b86e7c10956591efce7c6dbacf0af180 (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
60
61
62
63
64
65
66
// ArchiverInfo.h

#ifndef __ARCHIVERINFO_H
#define __ARCHIVERINFO_H

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

struct CArchiverExtInfo
{
  UString Ext;
  UString AddExt;
  CArchiverExtInfo() {}
  CArchiverExtInfo(const UString &ext): Ext(ext) {}
  CArchiverExtInfo(const UString &ext, const UString &addExt): Ext(ext), AddExt(addExt) {}
};

struct CArchiverInfo
{
  #ifndef EXCLUDE_COM
  UString FilePath;
  CLSID ClassID;
  #endif
  UString Name;
  CObjectVector<CArchiverExtInfo> Extensions;
  #ifndef _SFX
  CByteBuffer StartSignature;
  CByteBuffer FinishSignature;
  bool Associate;
  #endif
  int FindExtension(const UString &ext) const
  {
    for (int i = 0; i < Extensions.Size(); i++)
      if (ext.CompareNoCase(Extensions[i].Ext) == 0)
        return i;
    return -1;
  }
  UString GetAllExtensions() const
  {
    UString s;
    for (int i = 0; i < Extensions.Size(); i++)
    {
      if (i > 0)
        s += ' ';
      s += Extensions[i].Ext;
    }
    return s;
  }
  const UString &GetMainExtension() const 
  { 
    return Extensions[0].Ext;
  }
  bool UpdateEnabled;
  bool KeepName;

  CArchiverInfo(): UpdateEnabled(false), KeepName(false)
  #ifndef _SFX
  ,Associate(true)
  #endif
  {}
};

void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers);

#endif