Audacity 3.2.0
PluginInterface.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 PluginInterface.h
6
7 Leland Lucius
8
9 Copyright (c) 2014, Audacity Team
10 All rights reserved.
11
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions
14 are met:
15
16 1. Redistributions of source code must retain the above copyright
17 notice, this list of conditions and the following disclaimer.
18
19 2. Redistributions in binary form must reproduce the above copyright
20 notice, this list of conditions and the following disclaimer in the
21 documentation and/or other materials provided with the distribution.
22
23 3. Neither the name of the copyright holder nor the names of its
24 contributors may be used to endorse or promote products derived from
25 this software without specific prior written permission.
26
27 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 POSSIBILITY OF SUCH DAMAGE.
39
40**********************************************************************/
41
42#ifndef __AUDACITY_PLUGININTERFACE_H__
43#define __AUDACITY_PLUGININTERFACE_H__
44
45#include "EffectInterface.h"
46#include "ComponentInterface.h"
47#include "Identifier.h"
48#include "PluginProvider.h"
49#include "TypeListVisitor.h"
50#include <variant>
51
52class PluginProvider;
53
54namespace PluginSettings {
55
56enum ConfigurationType : unsigned {
58};
59
62 wxString
63 , int
64 , bool
65 , float
66 , double
67>;
68
74
75}
76
78using PluginRegistryVersion = wxString;
79
80MODULE_MANAGER_API
81bool Regver_eq(
82 const PluginRegistryVersion &regver1, const PluginRegistryVersion &regver2);
83
84// Compare registry versions
85MODULE_MANAGER_API
86bool Regver_lt(
87 const PluginRegistryVersion &regver1, const PluginRegistryVersion &regver2);
88
89// Compare registry versions
90inline bool Regver_le(
91 const PluginRegistryVersion &regver1, const PluginRegistryVersion &regver2)
92{
93 return !Regver_lt(regver2, regver1);
94}
95
96class MODULE_MANAGER_API PluginManagerInterface /* not final */
97{
98public:
102
104
105 static const PluginID &DefaultRegistrationCallback(
107 static const PluginID &AudacityCommandRegistrationCallback(
109
111
116 virtual bool IsPluginRegistered(
117 const PluginPath & path,
118 const TranslatableString *pName = nullptr) = 0;
119
120 virtual const PluginID & RegisterPlugin(PluginProvider *provider) = 0;
121 virtual const PluginID & RegisterPlugin(PluginProvider *provider, EffectDefinitionInterface *effect, int type) = 0;
122
123 virtual void FindFilesInPathList(const wxString & pattern,
124 const FilePaths & pathList,
125 FilePaths & files,
126 bool directories = false) = 0;
127
128 // Many functions corresponding to those in ConfigClientInterface, but
129 // with an extra ID argument
130 virtual bool GetConfigSubgroups(ConfigurationType type, const PluginID & ID,
131 const RegistryPath & group, RegistryPaths & subgroups) = 0;
132
133 virtual bool HasConfigValue(ConfigurationType type, const PluginID & ID,
134 const RegistryPath & group, const RegistryPath & key) = 0;
135
137 virtual bool GetConfigValue(ConfigurationType type, const PluginID & ID,
138 const RegistryPath & group, const RegistryPath & key,
139 ConfigReference var, ConfigConstReference defval) = 0;
140
141 virtual bool SetConfigValue(ConfigurationType type, const PluginID & ID,
142 const RegistryPath & group, const RegistryPath & key,
143 ConfigConstReference value) = 0;
144
146 const PluginID & ID, const RegistryPath & group) = 0;
147 virtual bool RemoveConfig(ConfigurationType type, const PluginID & ID,
148 const RegistryPath & group, const RegistryPath & key) = 0;
149
151 virtual const PluginRegistryVersion &GetRegistryVersion() const = 0;
152};
153
154#endif // __AUDACITY_PLUGININTERFACE_H__
wxString PluginID
wxString RegistryPath
Definition: Identifier.h:218
wxString PluginPath
type alias for identifying a Plugin supplied by a module, each module defining its own interpretation...
Definition: Identifier.h:214
std::vector< RegistryPath > RegistryPaths
Definition: Identifier.h:219
static CommandHandlerObject & ident(AudacityProject &project)
static const AudacityProject::AttachedObjects::RegisteredFactory key
bool Regver_le(const PluginRegistryVersion &regver1, const PluginRegistryVersion &regver2)
MODULE_MANAGER_API bool Regver_lt(const PluginRegistryVersion &regver1, const PluginRegistryVersion &regver2)
MODULE_MANAGER_API bool Regver_eq(const PluginRegistryVersion &regver1, const PluginRegistryVersion &regver2)
wxString PluginRegistryVersion
Type of plugin registry version information.
Generalized interface for discovery of plug-ins for one protocol.
ComponentInterface provides name / vendor / version functions to identify plugins....
EffectDefinitionInterface is a ComponentInterface that adds some basic read-only information about ef...
virtual bool RemoveConfigSubgroup(ConfigurationType type, const PluginID &ID, const RegistryPath &group)=0
virtual bool GetConfigValue(ConfigurationType type, const PluginID &ID, const RegistryPath &group, const RegistryPath &key, ConfigReference var, ConfigConstReference defval)=0
virtual bool RemoveConfig(ConfigurationType type, const PluginID &ID, const RegistryPath &group, const RegistryPath &key)=0
virtual const PluginID & RegisterPlugin(PluginProvider *provider, EffectDefinitionInterface *effect, int type)=0
virtual bool GetConfigSubgroups(ConfigurationType type, const PluginID &ID, const RegistryPath &group, RegistryPaths &subgroups)=0
PluginSettings::ConfigReference ConfigReference
virtual bool SetConfigValue(ConfigurationType type, const PluginID &ID, const RegistryPath &group, const RegistryPath &key, ConfigConstReference value)=0
virtual void FindFilesInPathList(const wxString &pattern, const FilePaths &pathList, FilePaths &files, bool directories=false)=0
virtual const PluginID & RegisterPlugin(PluginProvider *provider)=0
virtual bool IsPluginRegistered(const PluginPath &path, const TranslatableString *pName=nullptr)=0
Was the plugin registry already populated for a path (maybe from loading the config file)?
PluginSettings::ConfigConstReference ConfigConstReference
virtual bool HasConfigValue(ConfigurationType type, const PluginID &ID, const RegistryPath &group, const RegistryPath &key)=0
virtual ~PluginManagerInterface()
virtual const PluginRegistryVersion & GetRegistryVersion() const =0
What is the plugin registry version number now in the file?
Holds a msgid for the translation catalog; may also bind format arguments.
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
TypeListVisitor::VariantOfReferences_t< false, ConfigValueTypes > ConfigReference
Define a reference to a variable of one of the types in ConfigValueTypes.
TypeListVisitor::VariantOfReferences_t< true, ConfigValueTypes > ConfigConstReference
typename VariantOfReferences< Const, TypeList >::type VariantOfReferences_t
Primary template for a list of arbitrary types.
Definition: TypeList.h:61