Audacity 3.2.0
Functions
anonymous_namespace{PluginHost.cpp} Namespace Reference

Functions

void Discover (detail::PluginValidationResult &result, const wxString &providerId, const wxString &pluginPath)
 

Function Documentation

◆ Discover()

void anonymous_namespace{PluginHost.cpp}::Discover ( detail::PluginValidationResult result,
const wxString &  providerId,
const wxString &  pluginPath 
)

Definition at line 31 of file PluginHost.cpp.

32 {
33 try
34 {
35 if(auto provider = ModuleManager::Get().CreateProviderInstance(providerId, wxEmptyString))
36 {
37 TranslatableString errorMessage{};
38 auto validator = provider->MakeValidator();
39 auto numPlugins = provider->DiscoverPluginsAtPath(
40 pluginPath, errorMessage, [&](PluginProvider *provider, ComponentInterface *ident) -> const PluginID&
41 {
42 //Workaround: use DefaultRegistrationCallback to create all descriptors for us
43 //and then put a copy into result
45 if(const auto ptr = PluginManager::Get().GetPlugin(id))
46 {
47 auto desc = *ptr;
48 try
49 {
50 if(validator)
51 validator->Validate(*ident);
52 }
53 catch(...)
54 {
55 desc.SetEnabled(false);
56 desc.SetValid(false);
57 }
58 result.Add(std::move(desc));
59 }
60 return id;
61 });
62 if(!errorMessage.empty())
63 result.SetError(errorMessage.Debug());
64 else if(numPlugins == 0)
65 result.SetError("no plugins found");
66 }
67 else
68 result.SetError("provider not found");
69 }
70 catch(...)
71 {
72 result.SetError("unknown error");
73 }
74 }
wxString PluginID
static CommandHandlerObject & ident(AudacityProject &project)
int id
ComponentInterface provides name / vendor / version functions to identify plugins....
static ModuleManager & Get()
static PluginManager & Get()
static const PluginID & DefaultRegistrationCallback(PluginProvider *provider, ComponentInterface *ident)
Holds a msgid for the translation catalog; may also bind format arguments.
void SetError(const wxString &msg)
void Add(PluginDescriptor &&desc)
const TranslatableString desc
Definition: ExportPCM.cpp:51

References detail::PluginValidationResult::Add(), PluginManagerInterface::DefaultRegistrationCallback(), anonymous_namespace{ExportPCM.cpp}::desc, ModuleManager::Get(), PluginManager::Get(), id, ident(), and detail::PluginValidationResult::SetError().

Referenced by PluginHost::Serve().

Here is the call graph for this function:
Here is the caller graph for this function: