Audacity 3.2.0
PluginDescriptor.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 PluginDescriptor.h
6
7 Split from PluginManager.h
8
9**********************************************************************/
10
11#pragma once
12#include <wx/string.h>
13
14#include "PluginInterface.h"
15#include "XMLTagHandler.h"
16#include "wxArrayStringEx.h"
17
18class XMLWriter;
19
21//
22// PluginDescriptor
23//
25
26typedef enum : unsigned {
27 PluginTypeNone = 0, // 2.1.0 placeholder entries...not used by 2.1.1 or greater
28 PluginTypeStub =1, // Used for plugins that have not yet been registered
35
36class PluginDescriptorXMLTagHandler;
37
38// TODO: Convert this to multiple derived classes
41class MODULE_MANAGER_API PluginDescriptor final : public XMLTagHandler
42{
43public:
44
45 static constexpr auto XMLNodeName { "PluginDescriptor" };
46
47 PluginType GetPluginType() const;
48
49 // All plugins
50
51 // These return untranslated strings
52 const wxString & GetID() const;
53 const wxString & GetProviderID() const;
54 const PluginPath & GetPath() const;
55 const ComponentInterfaceSymbol & GetSymbol() const;
56
57 const wxString& GetUntranslatedVersion() const;
58 // There is no translated version
59
60 const wxString& GetVendor() const;
61
62 bool IsEnabled() const;
63 bool IsValid() const;
64
65 void SetEnabled(bool enable);
66 void SetValid(bool valid);
67
68 // Effect plugins only
69
70 // Internal string only, no translated counterpart!
71 // (Use Effect::GetFamilyName instead)
72 // This string persists in configuration files
73 // So config compatibility will break if it is changed across Audacity versions
74 wxString GetEffectFamily() const;
75
76 EffectType GetEffectType() const;
77 bool IsEffectDefault() const;
78 bool IsEffectInteractive() const;
79 bool IsEffectLegacy() const;
80 bool IsEffectRealtime() const;
81 bool IsEffectAutomatable() const;
82
83 // Importer plugins only
84
85 const wxString & GetImporterIdentifier() const;
87 const FileExtensions & GetImporterExtensions() const;
88
89 void WriteXML(XMLWriter& writer) const;
90
91 bool HandleXMLTag(const std::string_view& tag, const AttributesList& attrs) override;
92 XMLTagHandler* HandleXMLChild(const std::string_view& tag) override;
93 void HandleXMLEndTag(const std::string_view&) override;
94
95 void SetPluginType(PluginType type);
96
97 // These should be passed an untranslated value
98 void SetID(const PluginID & ID);
99 void SetProviderID(const PluginID & providerID);
100 void SetPath(const PluginPath & path);
101 void SetSymbol(const ComponentInterfaceSymbol & symbol);
102
103 // These should be passed an untranslated value wrapped in XO() so
104 // the value will still be extracted for translation
105 void SetVersion(const wxString & version);
106 void SetVendor(const wxString & vendor);
107
108 // "family" should be an untranslated string wrapped in wxT()
109 void SetEffectFamily(const wxString & family);
110 void SetEffectType(EffectType type);
111 void SetEffectDefault(bool dflt);
112 void SetEffectInteractive(bool interactive);
113 void SetEffectLegacy(bool legacy);
114 void SetEffectRealtime(bool realtime);
115 void SetEffectAutomatable(bool automatable);
116
117 void SetImporterIdentifier(const wxString & identifier);
119 void SetImporterExtensions(FileExtensions extensions);
120
121private:
122
123 // Common
124
125 PluginType mPluginType { PluginTypeNone };
126
127 wxString mID;
130 wxString mVersion;
131 wxString mVendor;
132 wxString mProviderID;
133 bool mEnabled {false};
134 bool mValid {false};
135
136 // Effects
137
140 bool mEffectInteractive {false};
141 bool mEffectDefault {false};
142 bool mEffectLegacy {false};
143 bool mEffectRealtime {false};
144 bool mEffectAutomatable {false};
145
146 // Importers
147
150};
EffectType
@ EffectTypeNone
wxString PluginID
Definition: EffectManager.h:30
static PluginID GetID(EffectPlugin &effect)
Definition: EffectUI.cpp:29
wxString PluginPath
type alias for identifying a Plugin supplied by a module, each module defining its own interpretation...
Definition: Identifier.h:214
PluginType
@ PluginTypeStub
@ PluginTypeModule
@ PluginTypeAudacityCommand
@ PluginTypeExporter
@ PluginTypeNone
@ PluginTypeEffect
@ PluginTypeImporter
std::vector< Attribute > AttributesList
Definition: XMLTagHandler.h:40
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
const TranslatableString & GetImporterFilterDescription() const
wxString mImporterIdentifier
void SetImporterFilterDescription(const TranslatableString &filterDesc)
FileExtensions mImporterExtensions
ComponentInterfaceSymbol mSymbol
Holds a msgid for the translation catalog; may also bind format arguments.
This class is an interface which should be implemented by classes which wish to be able to load and s...
Definition: XMLTagHandler.h:42
virtual XMLTagHandler * HandleXMLChild(const std::string_view &tag)=0
virtual void HandleXMLEndTag(const std::string_view &WXUNUSED(tag))
Definition: XMLTagHandler.h:59
virtual bool HandleXMLTag(const std::string_view &tag, const AttributesList &attrs)=0
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
Definition: XMLWriter.h:26
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.