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

FilePlugins.h « FileManager « 7zip « CPP - github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1becb9d1b0572dcb23fb56fd2f421a25317946d4 (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
// FilePlugins.h

#ifndef __FILEPLUGINS_H
#define __FILEPLUGINS_H

#include "RegistryPlugins.h"
#include "RegistryAssociations.h"

struct CPluginEnabledPair
{
  int Index;
  bool Enabled;
  CPluginEnabledPair(int index, bool enabled): Index(index),Enabled(enabled) {}
};

struct CExtInfoBig
{
  UString Ext;
  bool Associated;
  CRecordVector<CPluginEnabledPair> PluginsPairs;
  int FindPlugin(int pluginIndex)
  {
    for (int i = 0; i < PluginsPairs.Size(); i++)
      if (PluginsPairs[i].Index == pluginIndex)
        return i;
    return -1;
  }
};

class CExtDatabase
{
public:
  CObjectVector<CExtInfoBig> ExtBigItems;
  CObjectVector<CPluginInfo> Plugins;
  int FindExtInfoBig(const UString &ext);
  int FindPlugin(const UString &plugin);

  UString GetMainPluginNameForExtItem(int extIndex) const
  {
    const CExtInfoBig &extInfo = ExtBigItems[extIndex];
    if (extInfo.PluginsPairs.IsEmpty())
      return UString();
    else
      return Plugins[extInfo.PluginsPairs.Front().Index].Name;
  }

  void Read();
  void Save();
};


#endif