1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 14:02:57 +02:00

Use type aliases PluginPath, PluginPaths...

... for wxString and vector thereof, when holding plugin paths (which may or
may not be interpreted as file paths, depending on the module); to be replaced
later with different types
This commit is contained in:
Paul Licameli
2019-02-27 19:58:02 -05:00
parent 06b3b42794
commit dcd211affa
34 changed files with 179 additions and 169 deletions

View File

@@ -79,7 +79,7 @@ AudacityCommand::~AudacityCommand()
}
wxString AudacityCommand::GetPath(){ return BUILTIN_GENERIC_COMMAND_PREFIX + GetSymbol().Internal(); }
PluginPath AudacityCommand::GetPath(){ return BUILTIN_GENERIC_COMMAND_PREFIX + GetSymbol().Internal(); }
VendorSymbol AudacityCommand::GetVendor(){ return XO("Audacity");}
wxString AudacityCommand::GetVersion(){ return AUDACITY_VERSION_STRING;}

View File

@@ -63,7 +63,7 @@ class AUDACITY_DLL_API AudacityCommand /* not final */ : public wxEvtHandler,
// ComponentInterface implementation
//These four can be defaulted....
wxString GetPath() override;
PluginPath GetPath() override;
VendorSymbol GetVendor() override;
wxString GetVersion() override;
// virtual wxString GetFamily();

View File

@@ -173,7 +173,7 @@ BuiltinCommandsModule::~BuiltinCommandsModule()
// ComponentInterface implementation
// ============================================================================
wxString BuiltinCommandsModule::GetPath()
PluginPath BuiltinCommandsModule::GetPath()
{
return mPath;
}
@@ -250,13 +250,13 @@ bool BuiltinCommandsModule::AutoRegisterPlugins(PluginManagerInterface & pm)
return false;
}
wxArrayString BuiltinCommandsModule::FindPluginPaths(PluginManagerInterface & WXUNUSED(pm))
PluginPaths BuiltinCommandsModule::FindPluginPaths(PluginManagerInterface & WXUNUSED(pm))
{
return mNames;
}
unsigned BuiltinCommandsModule::DiscoverPluginsAtPath(
const wxString & path, wxString &errMsg,
const PluginPath & path, wxString &errMsg,
const RegistrationCallback &callback)
{
errMsg.clear();
@@ -273,14 +273,14 @@ unsigned BuiltinCommandsModule::DiscoverPluginsAtPath(
return 0;
}
bool BuiltinCommandsModule::IsPluginValid(const wxString & path, bool bFast)
bool BuiltinCommandsModule::IsPluginValid(const PluginPath & path, bool bFast)
{
// bFast is unused as checking in the list is fast.
static_cast<void>(bFast); // avoid unused variable warning
return make_iterator_range( mNames ).contains( path );
}
ComponentInterface *BuiltinCommandsModule::CreateInstance(const wxString & path)
ComponentInterface *BuiltinCommandsModule::CreateInstance(const PluginPath & path)
{
// Acquires a resource for the application.
// Safety of this depends on complementary calls to DeleteInstance on the module manager side.
@@ -299,7 +299,7 @@ void BuiltinCommandsModule::DeleteInstance(ComponentInterface *instance)
// BuiltinCommandsModule implementation
// ============================================================================
std::unique_ptr<AudacityCommand> BuiltinCommandsModule::Instantiate(const wxString & path)
std::unique_ptr<AudacityCommand> BuiltinCommandsModule::Instantiate(const PluginPath & path)
{
wxASSERT(path.StartsWith(BUILTIN_GENERIC_COMMAND_PREFIX));
auto index = make_iterator_range( mNames ).index( path );

View File

@@ -30,7 +30,7 @@ public:
// ComponentInterface implementation
wxString GetPath() override;
PluginPath GetPath() override;
ComponentInterfaceSymbol GetSymbol() override;
VendorSymbol GetVendor() override;
wxString GetVersion() override;
@@ -45,25 +45,25 @@ public:
wxString InstallPath() override { return {}; }
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
wxArrayString FindPluginPaths(PluginManagerInterface & pm) override;
PluginPaths FindPluginPaths(PluginManagerInterface & pm) override;
unsigned DiscoverPluginsAtPath(
const wxString & path, wxString &errMsg,
const PluginPath & path, wxString &errMsg,
const RegistrationCallback &callback)
override;
bool IsPluginValid(const wxString & path, bool bFast) override;
bool IsPluginValid(const PluginPath & path, bool bFast) override;
ComponentInterface *CreateInstance(const wxString & path) override;
ComponentInterface *CreateInstance(const PluginPath & path) override;
void DeleteInstance(ComponentInterface *instance) override;
private:
// BuiltinEffectModule implementation
std::unique_ptr<AudacityCommand> Instantiate(const wxString & path);
std::unique_ptr<AudacityCommand> Instantiate(const PluginPath & path);
private:
ModuleManagerInterface *mModMan;
wxString mPath;
wxArrayString mNames;
PluginPaths mNames;
};