File: PluginDescriptor.h

package info (click to toggle)
audacity 3.7.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 125,252 kB
  • sloc: cpp: 358,238; ansic: 75,458; lisp: 7,761; sh: 3,410; python: 1,503; xml: 1,385; perl: 854; makefile: 122
file content (158 lines) | stat: -rw-r--r-- 4,748 bytes parent folder | download | duplicates (3)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/**********************************************************************

  Audacity: A Digital Audio Editor

  PluginDescriptor.h

  Split from PluginManager.h

**********************************************************************/

#pragma once
#include <wx/string.h>

#include "EffectInterface.h"
#include "PluginInterface.h"
#include "XMLTagHandler.h"
#include "wxArrayStringEx.h"

class XMLWriter;

///////////////////////////////////////////////////////////////////////////////
//
// PluginDescriptor
//
///////////////////////////////////////////////////////////////////////////////

typedef enum : unsigned {
   PluginTypeNone = 0,          // 2.1.0 placeholder entries...not used by 2.1.1 or greater
   PluginTypeStub =1,               // Used for plugins that have not yet been registered
   PluginTypeEffect =1<<1,
   PluginTypeAudacityCommand=1<<2,
   PluginTypeExporter=1<<3,
   PluginTypeImporter=1<<4,
   PluginTypeModule=1<<5,
} PluginType;

class PluginDescriptorXMLTagHandler;

// TODO:  Convert this to multiple derived classes
//! Represents either a PluginProvider or a loaded plug-in and caches some
//! information about it
class MODULE_MANAGER_API PluginDescriptor final : public XMLTagHandler
{
public:

   static constexpr auto XMLNodeName { "PluginDescriptor" };

   PluginType GetPluginType() const;

   // All plugins

   // These return untranslated strings
   const wxString & GetID() const;
   const wxString & GetProviderID() const;
   const PluginPath & GetPath() const;
   const ComponentInterfaceSymbol & GetSymbol() const;

   const wxString& GetUntranslatedVersion() const;
   // There is no translated version

   const wxString& GetVendor() const;

   bool IsEnabled() const;
   bool IsValid() const;

   void SetEnabled(bool enable);
   void SetValid(bool valid);

   // Effect plugins only

   // Internal string only, no translated counterpart!
   // (Use Effect::GetFamilyName instead)
   // This string persists in configuration files
   // So config compatibility will break if it is changed across Audacity versions
   wxString GetEffectFamily() const;

   EffectType GetEffectType() const;
   bool IsEffectDefault() const;
   bool IsEffectInteractive() const;
   bool IsEffectLegacy() const;
   bool IsEffectRealtime() const;
   bool IsEffectAutomatable() const;

   // Importer plugins only

   const wxString & GetImporterIdentifier() const;
   const TranslatableString & GetImporterFilterDescription() const;
   const FileExtensions & GetImporterExtensions() const;

   void WriteXML(XMLWriter& writer) const;
   
   bool HandleXMLTag(const std::string_view& tag, const AttributesList& attrs) override;
   XMLTagHandler* HandleXMLChild(const std::string_view& tag) override;
   void HandleXMLEndTag(const std::string_view&) override;
   
   void SetPluginType(PluginType type);

   // These should be passed an untranslated value
   void SetID(const PluginID & ID);
   void SetProviderID(const PluginID & providerID);
   void SetPath(const PluginPath & path);
   void SetSymbol(const ComponentInterfaceSymbol & symbol);

   // These should be passed an untranslated value wrapped in XO() so
   // the value will still be extracted for translation
   void SetVersion(const wxString & version);
   void SetVendor(const wxString & vendor);

   // "family" should be an untranslated string wrapped in wxT()
   void SetEffectFamily(const wxString & family);
   void SetEffectType(EffectType type);
   void SetEffectDefault(bool dflt);
   void SetEffectInteractive(bool interactive);
   void SetEffectLegacy(bool legacy);
   void SetRealtimeSupport(EffectDefinitionInterface::RealtimeSince realtime);

   //! for serialization
   wxString SerializeRealtimeSupport() const;
   //! for deserialization
   void DeserializeRealtimeSupport(const wxString &value);

   void SetEffectAutomatable(bool automatable);

   void SetImporterIdentifier(const wxString & identifier);
   void SetImporterFilterDescription(const TranslatableString & filterDesc);
   void SetImporterExtensions(FileExtensions extensions);

private:

   // Common

   PluginType mPluginType { PluginTypeNone };

   wxString mID;
   PluginPath mPath;
   ComponentInterfaceSymbol mSymbol;
   wxString mVersion;
   wxString mVendor;
   wxString mProviderID;
   bool mEnabled {false};
   bool mValid {false};

   // Effects

   wxString mEffectFamily;
   EffectType mEffectType {EffectTypeNone};
   bool mEffectInteractive {false};
   bool mEffectDefault {false};
   bool mEffectLegacy {false};
   EffectDefinitionInterface::RealtimeSince mEffectRealtime {
      EffectDefinitionInterface::RealtimeSince::Never };
   bool mEffectAutomatable {false};

   // Importers

   wxString mImporterIdentifier;
   FileExtensions mImporterExtensions;
};