Audacity  3.0.3
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 "ModuleInterface.h"
49 #include <variant>
50 
51 class ModuleInterface;
52 
53 namespace PluginSettings {
54 
55 enum ConfigurationType : unsigned {
57 };
58 
60 using ConfigValueTypes = std::tuple<
61  wxString
62  , int
63  , bool
64  , float
65  , double
66 >;
67 
69 
70 template<bool is_const, typename> struct ConfigReferenceGenerator;
71 template<bool is_const, typename... Types>
72 struct 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 
83 class AUDACITY_DLL_API PluginManagerInterface /* not final */
84 {
85 public:
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(ModuleInterface *module) = 0;
108  virtual const PluginID & RegisterPlugin(ModuleInterface *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 
121  virtual bool GetConfigValue(ConfigurationType type, const PluginID & ID,
122  const RegistryPath & group, const RegistryPath & key,
123  ConfigReference var, ConfigConstReference defval) = 0;
124 
125  virtual bool SetConfigValue(ConfigurationType type, const PluginID & ID,
126  const RegistryPath & group, const RegistryPath & key,
127  ConfigConstReference value) = 0;
128 
130  const PluginID & ID, const RegistryPath & group) = 0;
131  virtual bool RemoveConfig(ConfigurationType type, const PluginID & ID,
132  const RegistryPath & group, const RegistryPath & key) = 0;
133 };
134 
135 #endif // __AUDACITY_PLUGININTERFACE_H__
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
PluginManagerInterface::SetConfigValue
virtual bool SetConfigValue(ConfigurationType type, const PluginID &ID, const RegistryPath &group, const RegistryPath &key, ConfigConstReference value)=0
EffectInterface.h
ident
static CommandHandlerObject & ident(AudacityProject &project)
Definition: ModNullCallback.cpp:65
RegistryPaths
std::vector< RegistryPath > RegistryPaths
Definition: Identifier.h:219
PluginPath
wxString PluginPath
type alias for identifying a Plugin supplied by a module, each module defining its own interpretation...
Definition: Identifier.h:214
ModuleInterface.h
PluginManagerInterface::RegisterPlugin
virtual const PluginID & RegisterPlugin(ModuleInterface *module)=0
wxArrayStringEx
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
Definition: wxArrayStringEx.h:18
PluginManagerInterface::RemoveConfigSubgroup
virtual bool RemoveConfigSubgroup(ConfigurationType type, const PluginID &ID, const RegistryPath &group)=0
PluginSettings
Definition: ConfigInterface.cpp:12
ModuleInterface
Definition: ModuleInterface.h:75
PluginSettings::Shared
@ Shared
Definition: PluginInterface.h:56
PluginManagerInterface::IsPluginRegistered
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)?
ComponentInterface.h
PluginManagerInterface
Definition: PluginInterface.h:84
PluginManagerInterface::ConfigConstReference
PluginSettings::ConfigConstReference ConfigConstReference
Definition: PluginInterface.h:88
PluginID
wxString PluginID
Definition: EffectManager.h:31
PluginManagerInterface::GetConfigSubgroups
virtual bool GetConfigSubgroups(ConfigurationType type, const PluginID &ID, const RegistryPath &group, RegistryPaths &subgroups)=0
Identifier.h
PluginSettings::ConfigReferenceGenerator
Define a reference to a variable of one of the types in ConfigValueTypes.
Definition: PluginInterface.h:70
PluginManagerInterface::FindFilesInPathList
virtual void FindFilesInPathList(const wxString &pattern, const FilePaths &pathList, FilePaths &files, bool directories=false)=0
RegistryPath
wxString RegistryPath
Definition: Identifier.h:218
PluginManagerInterface::ConfigReference
PluginSettings::ConfigReference ConfigReference
Definition: PluginInterface.h:87
PluginSettings::ConfigConstReference
ConfigReferenceGenerator< true, ConfigValueTypes >::type ConfigConstReference
Definition: PluginInterface.h:79
EffectDefinitionInterface
EffectDefinitionInterface is a ComponentInterface that additionally tracks flag-functions for interac...
Definition: EffectInterface.h:73
key
static const AudacityProject::AttachedObjects::RegisteredFactory key
Definition: CommandManager.cpp:201
PluginManagerInterface::GetConfigValue
virtual bool GetConfigValue(ConfigurationType type, const PluginID &ID, const RegistryPath &group, const RegistryPath &key, ConfigReference var, ConfigConstReference defval)=0
PluginManagerInterface::RemoveConfig
virtual bool RemoveConfig(ConfigurationType type, const PluginID &ID, const RegistryPath &group, const RegistryPath &key)=0
ComponentInterface
ComponentInterface provides name / vendor / version functions to identify plugins....
Definition: ComponentInterface.h:62
PluginSettings::ConfigReferenceGenerator< is_const, std::tuple< Types... > >::type
std::variant< std::reference_wrapper< std::conditional_t< is_const, const Types, Types > >... > type
Definition: PluginInterface.h:74
PluginSettings::ConfigValueTypes
std::tuple< wxString, int, bool, float, double > ConfigValueTypes
Supported types for settings.
Definition: PluginInterface.h:66
PluginSettings::ConfigurationType
ConfigurationType
Definition: PluginInterface.h:55
Journal::Events::anonymous_namespace{JournalEvents.cpp}::Types
std::vector< Type > Types
Definition: JournalEvents.cpp:41
PluginManagerInterface::RegisterPlugin
virtual const PluginID & RegisterPlugin(ModuleInterface *provider, EffectDefinitionInterface *effect, int type)=0
PluginSettings::Private
@ Private
Definition: PluginInterface.h:56
PluginSettings::ConfigReference
ConfigReferenceGenerator< false, ConfigValueTypes >::type ConfigReference
Definition: PluginInterface.h:77
PluginManagerInterface::~PluginManagerInterface
virtual ~PluginManagerInterface()