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 <variant>
50
51class PluginProvider;
52
53namespace PluginSettings {
54
55enum ConfigurationType : unsigned {
57};
58
60using ConfigValueTypes = std::tuple<
61 wxString
62 , int
63 , bool
64 , float
65 , double
66>;
67
69
70template<bool is_const, typename> struct ConfigReferenceGenerator;
71template<bool is_const, typename... Types>
72struct ConfigReferenceGenerator<is_const, std::tuple<Types...>> {
73 using type = std::variant< std::reference_wrapper<
74 std::conditional_t<is_const, const Types, Types> >... >;
75};
80
81}
82
83class MODULE_MANAGER_API PluginManagerInterface /* not final */
84{
85public:
89
91
92 static const PluginID &DefaultRegistrationCallback(
94 static const PluginID &AudacityCommandRegistrationCallback(
96
98
103 virtual bool IsPluginRegistered(
104 const PluginPath & path,
105 const TranslatableString *pName = nullptr) = 0;
106
107 virtual const PluginID & RegisterPlugin(PluginProvider *provider) = 0;
108 virtual const PluginID & RegisterPlugin(PluginProvider *provider, EffectDefinitionInterface *effect, int type) = 0;
109
110 virtual void FindFilesInPathList(const wxString & pattern,
111 const FilePaths & pathList,
112 FilePaths & files,
113 bool directories = false) = 0;
114
115 // Many functions corresponding to those in ConfigClientInterface, but
116 // with an extra ID argument
117 virtual bool GetConfigSubgroups(ConfigurationType type, const PluginID & ID,
118 const RegistryPath & group, RegistryPaths & subgroups) = 0;
119
120 virtual bool HasConfigValue(ConfigurationType type, const PluginID & ID,
121 const RegistryPath & group, const RegistryPath & key) = 0;
122
124 virtual bool GetConfigValue(ConfigurationType type, const PluginID & ID,
125 const RegistryPath & group, const RegistryPath & key,
126 ConfigReference var, ConfigConstReference defval) = 0;
127
128 virtual bool SetConfigValue(ConfigurationType type, const PluginID & ID,
129 const RegistryPath & group, const RegistryPath & key,
130 ConfigConstReference value) = 0;
131
133 const PluginID & ID, const RegistryPath & group) = 0;
134 virtual bool RemoveConfig(ConfigurationType type, const PluginID & ID,
135 const RegistryPath & group, const RegistryPath & key) = 0;
136};
137
138#endif // __AUDACITY_PLUGININTERFACE_H__
static const AudacityProject::AttachedObjects::RegisteredFactory key
wxString PluginID
Definition: EffectManager.h:30
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)
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()
Holds a msgid for the translation catalog; may also bind format arguments.
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
std::tuple< wxString, int, bool, float, double > ConfigValueTypes
Supported types for settings.
ConfigReferenceGenerator< false, ConfigValueTypes >::type ConfigReference
ConfigReferenceGenerator< true, ConfigValueTypes >::type ConfigConstReference
STL namespace.
std::variant< std::reference_wrapper< std::conditional_t< is_const, const Types, Types > >... > type
Define a reference to a variable of one of the types in ConfigValueTypes.