Use type aliases FileExtension, FileExtensions...
... for wxString and wxArrayStringEx, holding file extensions (without dot); to be replaced later with different types (not yet using std::vector, becase of some uses of wxArrayString::Index with two arguments) And simplify some constructions of arrays
This commit is contained in:
parent
df6a2cf479
commit
485b6bb425
|
@ -72,7 +72,7 @@ public:
|
|||
// Get a list of extensions this plugin expects to be able to
|
||||
// import. If a filename matches any of these extensions,
|
||||
// this importer will get first dibs on importing it.
|
||||
virtual wxArrayString GetSupportedExtensions() = 0;
|
||||
virtual FileExtensions GetSupportedExtensions() = 0;
|
||||
virtual bool SupportsExtension(const wxString & extension) = 0;
|
||||
|
||||
// Create the client that will be used to import a file.
|
||||
|
|
|
@ -84,7 +84,7 @@ public:
|
|||
// This function returns nonempty only when that is the case, and lists
|
||||
// the possible extensions of such files (an empty string in a nonempty
|
||||
// array means any file is a candidate).
|
||||
virtual wxArrayString GetFileExtensions() = 0;
|
||||
virtual FileExtensions GetFileExtensions() = 0;
|
||||
|
||||
// Returns empty, or else, where to copy a plug-in file or bundle.
|
||||
// Drag-and-drop is supported only if GetFileExtensions() returns nonempty and
|
||||
|
|
|
@ -67,6 +67,12 @@ using PluginPaths = std::vector< PluginPath >;
|
|||
using RegistryPath = wxString;
|
||||
using RegistryPaths = std::vector< RegistryPath >;
|
||||
|
||||
class wxArrayStringEx;
|
||||
|
||||
// File extensions, not including any leading dot
|
||||
using FileExtension = wxString;
|
||||
using FileExtensions = wxArrayStringEx;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// A native 64-bit integer...used when referring to any number of samples
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
@ -504,7 +504,8 @@ bool MacroCommands::IsMono()
|
|||
return ( tracks->Any() - &Track::IsLeader ).empty();
|
||||
}
|
||||
|
||||
wxString MacroCommands::BuildCleanFileName(const wxString &fileName, const wxString &extension)
|
||||
wxString MacroCommands::BuildCleanFileName(const wxString &fileName,
|
||||
const FileExtension &extension)
|
||||
{
|
||||
const wxFileName newFileName{ fileName };
|
||||
wxString justName = newFileName.GetName();
|
||||
|
|
|
@ -74,7 +74,8 @@ class MacroCommands final {
|
|||
void AbortBatch();
|
||||
|
||||
// Utility functions for the special commands.
|
||||
static wxString BuildCleanFileName(const wxString &fileName, const wxString &extension);
|
||||
static wxString BuildCleanFileName(const wxString &fileName,
|
||||
const FileExtension &extension);
|
||||
bool WriteMp3File( const wxString & Name, int bitrate );
|
||||
double GetEndTime();
|
||||
static bool IsMono();
|
||||
|
|
|
@ -204,9 +204,9 @@ bool sf_subtype_is_integer(unsigned int format)
|
|||
subtype == SF_FORMAT_PCM_32);
|
||||
}
|
||||
|
||||
wxArrayString sf_get_all_extensions()
|
||||
FileExtensions sf_get_all_extensions()
|
||||
{
|
||||
wxArrayStringEx exts;
|
||||
FileExtensions exts;
|
||||
SF_FORMAT_INFO format_info;
|
||||
int count, k;
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <wx/string.h>
|
||||
|
||||
#include "Audacity.h"
|
||||
#include "audacity/Types.h"
|
||||
|
||||
#include "sndfile.h"
|
||||
|
||||
|
@ -97,7 +98,7 @@ SF_FORMAT_INFO *sf_simple_format(int i);
|
|||
bool sf_subtype_more_than_16_bits(unsigned int format);
|
||||
bool sf_subtype_is_integer(unsigned int format);
|
||||
|
||||
wxArrayString sf_get_all_extensions();
|
||||
extern FileExtensions sf_get_all_extensions();
|
||||
|
||||
wxString sf_normalize_name(const char *name);
|
||||
|
||||
|
|
|
@ -1320,14 +1320,15 @@ void PluginDescriptor::SetImporterFilterDescription(const wxString & filterDesc)
|
|||
mImporterFilterDesc = filterDesc;
|
||||
}
|
||||
|
||||
const wxArrayString & PluginDescriptor::GetImporterExtensions() const
|
||||
const FileExtensions & PluginDescriptor::GetImporterExtensions()
|
||||
const
|
||||
{
|
||||
return mImporterExtensions;
|
||||
}
|
||||
|
||||
void PluginDescriptor::SetImporterExtensions(const wxArrayString & extensions)
|
||||
void PluginDescriptor::SetImporterExtensions( FileExtensions extensions )
|
||||
{
|
||||
mImporterExtensions = extensions;
|
||||
mImporterExtensions = std::move( extensions );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2199,7 +2200,7 @@ void PluginManager::LoadGroup(wxFileConfig *pRegistry, PluginType type)
|
|||
{
|
||||
continue;
|
||||
}
|
||||
wxArrayString extensions;
|
||||
FileExtensions extensions;
|
||||
wxStringTokenizer tkr(strVal, wxT(":"));
|
||||
while (tkr.HasMoreTokens())
|
||||
{
|
||||
|
|
|
@ -112,11 +112,11 @@ public:
|
|||
|
||||
const wxString & GetImporterIdentifier() const;
|
||||
const wxString & GetImporterFilterDescription() const;
|
||||
const wxArrayString & GetImporterExtensions() const;
|
||||
const FileExtensions & GetImporterExtensions() const;
|
||||
|
||||
void SetImporterIdentifier(const wxString & identifier);
|
||||
void SetImporterFilterDescription(const wxString & filterDesc);
|
||||
void SetImporterExtensions(const wxArrayString & extensions);
|
||||
void SetImporterExtensions(FileExtensions extensions);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -154,7 +154,7 @@ private:
|
|||
|
||||
wxString mImporterIdentifier;
|
||||
wxString mImporterFilterDesc;
|
||||
wxArrayString mImporterExtensions;
|
||||
FileExtensions mImporterExtensions;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
bool Initialize() override;
|
||||
void Terminate() override;
|
||||
|
||||
wxArrayString GetFileExtensions() override { return {}; }
|
||||
FileExtensions GetFileExtensions() override { return {}; }
|
||||
wxString InstallPath() override { return {}; }
|
||||
|
||||
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
bool Initialize() override;
|
||||
void Terminate() override;
|
||||
|
||||
wxArrayString GetFileExtensions() override { return {}; }
|
||||
FileExtensions GetFileExtensions() override { return {}; }
|
||||
wxString InstallPath() override { return {}; }
|
||||
|
||||
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
|
||||
|
|
|
@ -363,11 +363,9 @@ void VSTEffectsModule::Terminate()
|
|||
return;
|
||||
}
|
||||
|
||||
wxArrayString VSTEffectsModule::GetFileExtensions()
|
||||
FileExtensions VSTEffectsModule::GetFileExtensions()
|
||||
{
|
||||
static const wxString ext[] = { _T("vst") };
|
||||
static const wxArrayString result{ sizeof(ext)/sizeof(*ext), ext };
|
||||
return result;
|
||||
return {{ _T("vst") }};
|
||||
}
|
||||
|
||||
wxString VSTEffectsModule::InstallPath()
|
||||
|
|
|
@ -403,7 +403,7 @@ public:
|
|||
bool Initialize() override;
|
||||
void Terminate() override;
|
||||
|
||||
wxArrayString GetFileExtensions() override;
|
||||
FileExtensions GetFileExtensions() override;
|
||||
wxString InstallPath() override;
|
||||
|
||||
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
|
||||
|
|
|
@ -137,11 +137,9 @@ wxString AudioUnitEffectsModule::GetDescription()
|
|||
// ModuleInterface implementation
|
||||
// ============================================================================
|
||||
|
||||
wxArrayString AudioUnitEffectsModule::GetFileExtensions()
|
||||
FileExtensions AudioUnitEffectsModule::GetFileExtensions()
|
||||
{
|
||||
static const wxString ext[] = { _T("au") };
|
||||
static const wxArrayString result{ sizeof(ext)/sizeof(*ext), ext };
|
||||
return result;
|
||||
return {{ _T("au") }};
|
||||
}
|
||||
|
||||
bool AudioUnitEffectsModule::Initialize()
|
||||
|
|
|
@ -242,7 +242,7 @@ public:
|
|||
bool Initialize() override;
|
||||
void Terminate() override;
|
||||
|
||||
wxArrayString GetFileExtensions() override;
|
||||
FileExtensions GetFileExtensions() override;
|
||||
wxString InstallPath() override { return {}; }
|
||||
|
||||
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
|
||||
|
|
|
@ -156,28 +156,26 @@ void LadspaEffectsModule::Terminate()
|
|||
return;
|
||||
}
|
||||
|
||||
wxArrayString LadspaEffectsModule::GetFileExtensions()
|
||||
FileExtensions LadspaEffectsModule::GetFileExtensions()
|
||||
{
|
||||
static const wxString ext[] = {
|
||||
return {{
|
||||
|
||||
#ifdef __WXMSW__
|
||||
|
||||
{ _T("dll") }
|
||||
_T("dll")
|
||||
|
||||
#else
|
||||
|
||||
{ _T("so") }
|
||||
_T("so")
|
||||
|
||||
#ifdef __WXMAC__
|
||||
// Is it correct that these are candidate plug-in files too for macOs?
|
||||
, { _T("dylib") }
|
||||
, _T("dylib")
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
static const wxArrayString result{ sizeof(ext)/sizeof(*ext), ext };
|
||||
return result;
|
||||
}};
|
||||
}
|
||||
|
||||
wxString LadspaEffectsModule::InstallPath()
|
||||
|
|
|
@ -222,7 +222,7 @@ public:
|
|||
bool Initialize() override;
|
||||
void Terminate() override;
|
||||
|
||||
wxArrayString GetFileExtensions() override;
|
||||
FileExtensions GetFileExtensions() override;
|
||||
wxString InstallPath() override;
|
||||
|
||||
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#ifndef LV2EFFECTSMODULE_H
|
||||
#define LV2EFFECTSMODULE_H
|
||||
|
||||
#include "../../MemoryX.h"
|
||||
#include <wx/hashmap.h>
|
||||
#include <wx/string.h>
|
||||
|
||||
|
@ -87,7 +88,7 @@ public:
|
|||
bool Initialize() override;
|
||||
void Terminate() override;
|
||||
|
||||
wxArrayString GetFileExtensions() override { return {}; }
|
||||
FileExtensions GetFileExtensions() override { return {}; }
|
||||
wxString InstallPath() override { return {}; }
|
||||
|
||||
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
|
||||
|
|
|
@ -155,11 +155,9 @@ void NyquistEffectsModule::Terminate()
|
|||
return;
|
||||
}
|
||||
|
||||
wxArrayString NyquistEffectsModule::GetFileExtensions()
|
||||
FileExtensions NyquistEffectsModule::GetFileExtensions()
|
||||
{
|
||||
static const wxString ext[] = { _T("ny") };
|
||||
static const wxArrayString result{ sizeof(ext)/sizeof(*ext), ext };
|
||||
return result;
|
||||
return {{ _T("ny") }};
|
||||
}
|
||||
|
||||
wxString NyquistEffectsModule::InstallPath()
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
bool Initialize() override;
|
||||
void Terminate() override;
|
||||
|
||||
wxArrayString GetFileExtensions() override;
|
||||
FileExtensions GetFileExtensions() override;
|
||||
wxString InstallPath() override;
|
||||
|
||||
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
bool Initialize() override;
|
||||
void Terminate() override;
|
||||
|
||||
wxArrayString GetFileExtensions() override { return {}; }
|
||||
FileExtensions GetFileExtensions() override { return {}; }
|
||||
wxString InstallPath() override { return {}; }
|
||||
|
||||
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
|
||||
|
|
|
@ -128,9 +128,9 @@ void ExportPlugin::AddExtension(const wxString &extension,int index)
|
|||
mFormatInfos[index].mExtensions.push_back(extension);
|
||||
}
|
||||
|
||||
void ExportPlugin::SetExtensions(const wxArrayString & extensions, int index)
|
||||
void ExportPlugin::SetExtensions(FileExtensions extensions, int index)
|
||||
{
|
||||
mFormatInfos[index].mExtensions = extensions;
|
||||
mFormatInfos[index].mExtensions = std::move(extensions);
|
||||
}
|
||||
|
||||
void ExportPlugin::SetMask(const wxString & mask, int index)
|
||||
|
@ -158,12 +158,12 @@ wxString ExportPlugin::GetDescription(int index)
|
|||
return mFormatInfos[index].mDescription;
|
||||
}
|
||||
|
||||
wxString ExportPlugin::GetExtension(int index)
|
||||
FileExtension ExportPlugin::GetExtension(int index)
|
||||
{
|
||||
return mFormatInfos[index].mExtensions[0];
|
||||
}
|
||||
|
||||
wxArrayString ExportPlugin::GetExtensions(int index)
|
||||
FileExtensions ExportPlugin::GetExtensions(int index)
|
||||
{
|
||||
return mFormatInfos[index].mExtensions;
|
||||
}
|
||||
|
@ -177,8 +177,8 @@ wxString ExportPlugin::GetMask(int index)
|
|||
wxString mask = GetDescription(index) + wxT("|");
|
||||
|
||||
// Build the mask
|
||||
// wxString ext = GetExtension(index);
|
||||
auto exts = GetExtensions(index);
|
||||
// const auto &ext = GetExtension(index);
|
||||
const auto &exts = GetExtensions(index);
|
||||
for (size_t i = 0; i < exts.size(); i++) {
|
||||
mask += wxT("*.") + exts[i] + wxT(";");
|
||||
}
|
||||
|
@ -201,8 +201,8 @@ bool ExportPlugin::IsExtension(const wxString & ext, int index)
|
|||
bool isext = false;
|
||||
for (int i = index; i < GetFormatCount(); i = GetFormatCount())
|
||||
{
|
||||
wxString defext = GetExtension(i);
|
||||
auto defexts = GetExtensions(i);
|
||||
const auto &defext = GetExtension(i);
|
||||
const auto &defexts = GetExtensions(i);
|
||||
int indofext = defexts.Index(ext, false);
|
||||
if (defext.empty() || (indofext != wxNOT_FOUND))
|
||||
isext = true;
|
||||
|
@ -616,7 +616,7 @@ bool Exporter::GetFilename()
|
|||
}
|
||||
}
|
||||
|
||||
wxString ext = mFilename.GetExt();
|
||||
const auto &ext = mFilename.GetExt();
|
||||
defext = mPlugins[mFormat]->GetExtension(mSubFormat).Lower();
|
||||
|
||||
//
|
||||
|
|
|
@ -48,7 +48,7 @@ class AUDACITY_DLL_API FormatInfo
|
|||
wxString mFormat;
|
||||
wxString mDescription;
|
||||
// wxString mExtension;
|
||||
wxArrayString mExtensions;
|
||||
FileExtensions mExtensions;
|
||||
wxString mMask;
|
||||
unsigned mMaxChannels;
|
||||
bool mCanMetaData;
|
||||
|
@ -68,7 +68,7 @@ public:
|
|||
void SetFormat(const wxString & format, int index);
|
||||
void SetDescription(const wxString & description, int index);
|
||||
void AddExtension(const wxString &extension,int index);
|
||||
void SetExtensions(const wxArrayString & extensions, int index);
|
||||
void SetExtensions(FileExtensions extensions, int index);
|
||||
void SetMask(const wxString & mask, int index);
|
||||
void SetMaxChannels(unsigned maxchannels, unsigned index);
|
||||
void SetCanMetaData(bool canmetadata, int index);
|
||||
|
@ -78,10 +78,10 @@ public:
|
|||
virtual wxString GetDescription(int index);
|
||||
/** @brief Return the (first) file name extension for the sub-format.
|
||||
* @param index The sub-format for which the extension is wanted */
|
||||
virtual wxString GetExtension(int index = 0);
|
||||
virtual FileExtension GetExtension(int index = 0);
|
||||
/** @brief Return all the file name extensions used for the sub-format.
|
||||
* @param index the sub-format for which the extension is required */
|
||||
virtual wxArrayString GetExtensions(int index = 0);
|
||||
virtual FileExtensions GetExtensions(int index = 0);
|
||||
virtual wxString GetMask(int index);
|
||||
virtual unsigned GetMaxChannels(int index);
|
||||
virtual bool GetCanMetaData(int index);
|
||||
|
|
|
@ -340,7 +340,7 @@ public:
|
|||
const Tags *metadata = NULL,
|
||||
int subformat = 0) override;
|
||||
// optional
|
||||
wxString GetExtension(int index) override;
|
||||
FileExtension GetExtension(int index) override;
|
||||
bool CheckFileName(wxFileName &filename, int format) override;
|
||||
|
||||
private:
|
||||
|
@ -890,7 +890,7 @@ wxWindow *ExportPCM::OptionsCreate(wxWindow *parent, int format)
|
|||
return ExportPlugin::OptionsCreate(parent, format);
|
||||
}
|
||||
|
||||
wxString ExportPCM::GetExtension(int index)
|
||||
FileExtension ExportPCM::GetExtension(int index)
|
||||
{
|
||||
if (index == WXSIZEOF(kFormats)) {
|
||||
// get extension libsndfile thinks is correct for currently selected format
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "ImportRaw.h" // defines TrackHolders
|
||||
#include "ImportForwards.h"
|
||||
#include "audacity/Types.h"
|
||||
#include <vector>
|
||||
#include <wx/arrstr.h>
|
||||
#include <wx/string.h>
|
||||
|
@ -32,11 +33,12 @@ typedef bool (*progress_callback_t)( void *userData, float percent );
|
|||
class Format {
|
||||
public:
|
||||
wxString formatName;
|
||||
wxArrayString formatExtensions;
|
||||
FileExtensions formatExtensions;
|
||||
|
||||
Format(const wxString &_formatName, const wxArrayString &_formatExtensions):
|
||||
Format(const wxString &_formatName,
|
||||
FileExtensions _formatExtensions):
|
||||
formatName(_formatName),
|
||||
formatExtensions(_formatExtensions)
|
||||
formatExtensions( std::move( _formatExtensions ) )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
|
@ -41,8 +41,7 @@ Licensed under the GNU General Public License v2 or later
|
|||
|
||||
//TODO: remove non-audio extensions
|
||||
#if defined(USE_FFMPEG)
|
||||
static const wxChar *exts[] =
|
||||
{
|
||||
static const auto exts = {
|
||||
wxT("4xm"),
|
||||
wxT("MTV"),
|
||||
wxT("roq"),
|
||||
|
@ -173,10 +172,9 @@ class FFmpegImportPlugin final : public ImportPlugin
|
|||
{
|
||||
public:
|
||||
FFmpegImportPlugin():
|
||||
ImportPlugin(wxArrayString(WXSIZEOF(exts),exts))
|
||||
{
|
||||
|
||||
}
|
||||
ImportPlugin( FileExtensions( exts.begin(), exts.end() ) )
|
||||
{
|
||||
}
|
||||
|
||||
~FFmpegImportPlugin() { }
|
||||
|
||||
|
|
|
@ -50,8 +50,7 @@
|
|||
|
||||
#define DESC _("FLAC files")
|
||||
|
||||
static const wxChar *exts[] =
|
||||
{
|
||||
static const auto exts = {
|
||||
wxT("flac"),
|
||||
wxT("flc")
|
||||
};
|
||||
|
@ -63,7 +62,7 @@ void GetFLACImportPlugin(ImportPluginList &importPluginList,
|
|||
{
|
||||
unusableImportPluginList.push_back(
|
||||
std::make_unique<UnusableImportPlugin>
|
||||
(DESC, wxArrayString(WXSIZEOF(exts), exts))
|
||||
(DESC, FileExtensions( exts.begin(), exts.end() ) )
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -133,7 +132,7 @@ class FLACImportPlugin final : public ImportPlugin
|
|||
{
|
||||
public:
|
||||
FLACImportPlugin():
|
||||
ImportPlugin(wxArrayString(WXSIZEOF(exts), exts))
|
||||
ImportPlugin( FileExtensions( exts.begin(), exts.end() ) )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -246,11 +246,11 @@ public:
|
|||
///! Destructor
|
||||
virtual ~GStreamerImportPlugin();
|
||||
|
||||
wxString GetPluginFormatDescription();
|
||||
wxString GetPluginFormatDescription() override;
|
||||
|
||||
wxString GetPluginStringID();
|
||||
wxString GetPluginStringID() override;
|
||||
|
||||
wxArrayString GetSupportedExtensions();
|
||||
FileExtensions GetSupportedExtensions() override;
|
||||
|
||||
///! Probes the file and opens it if appropriate
|
||||
std::unique_ptr<ImportFileHandle> Open(const wxString &Filename) override;
|
||||
|
@ -316,7 +316,7 @@ GetGStreamerImportPlugin(ImportPluginList &importPluginList,
|
|||
// ----------------------------------------------------------------------------
|
||||
// Constructor
|
||||
GStreamerImportPlugin::GStreamerImportPlugin()
|
||||
: ImportPlugin(wxArrayString())
|
||||
: ImportPlugin( {} )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -344,7 +344,7 @@ GStreamerImportPlugin::GetPluginStringID()
|
|||
|
||||
// Obtains a list of supported extensions from typefind factories
|
||||
// TODO: improve the list. It is obviously incomplete.
|
||||
wxArrayString
|
||||
FileExtensions
|
||||
GStreamerImportPlugin::GetSupportedExtensions()
|
||||
{
|
||||
// We refresh the extensions each time this is called in case the
|
||||
|
|
|
@ -96,8 +96,7 @@
|
|||
|
||||
#define DESC _("List of Files in basic text format")
|
||||
|
||||
static const wxChar *exts[] =
|
||||
{
|
||||
static const auto exts = {
|
||||
wxT("lof")
|
||||
};
|
||||
|
||||
|
@ -105,7 +104,7 @@ class LOFImportPlugin final : public ImportPlugin
|
|||
{
|
||||
public:
|
||||
LOFImportPlugin()
|
||||
: ImportPlugin(wxArrayString(WXSIZEOF(exts), exts))
|
||||
: ImportPlugin( FileExtensions( exts.begin(), exts.end() ) )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -49,8 +49,7 @@
|
|||
|
||||
#define DESC _("MP3 files")
|
||||
|
||||
static const wxChar *exts[] =
|
||||
{
|
||||
static const auto exts = {
|
||||
wxT("mp3"),
|
||||
wxT("mp2"),
|
||||
wxT("mpa")
|
||||
|
@ -63,7 +62,7 @@ void GetMP3ImportPlugin(ImportPluginList &importPluginList,
|
|||
{
|
||||
unusableImportPluginList.push_back(
|
||||
std::make_unique<UnusableImportPlugin>
|
||||
(DESC, wxArrayString(WXSIZEOF(exts), exts))
|
||||
(DESC, FileExtensions( exts.begin(), exts.end() ) )
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -114,7 +113,7 @@ class MP3ImportPlugin final : public ImportPlugin
|
|||
{
|
||||
public:
|
||||
MP3ImportPlugin():
|
||||
ImportPlugin(wxArrayString(WXSIZEOF(exts), exts))
|
||||
ImportPlugin( FileExtensions( exts.begin(), exts.end() ) )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -47,8 +47,7 @@
|
|||
|
||||
#define DESC _("Ogg Vorbis files")
|
||||
|
||||
static const wxChar *exts[] =
|
||||
{
|
||||
static const auto exts = {
|
||||
wxT("ogg")
|
||||
};
|
||||
|
||||
|
@ -61,7 +60,7 @@ void GetOGGImportPlugin(ImportPluginList &importPluginList,
|
|||
{
|
||||
unusableImportPluginList.push_back(
|
||||
std::make_unique<UnusableImportPlugin>
|
||||
(DESC, wxArrayString(WXSIZEOF(exts), exts))
|
||||
(DESC, FileExtensions( exts.begin(), exts.end() ) )
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -86,7 +85,7 @@ class OggImportPlugin final : public ImportPlugin
|
|||
{
|
||||
public:
|
||||
OggImportPlugin()
|
||||
: ImportPlugin(wxArrayString(WXSIZEOF(exts), exts))
|
||||
: ImportPlugin( FileExtensions( exts.begin(), exts.end() ) )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -73,9 +73,8 @@ class PCMImportPlugin final : public ImportPlugin
|
|||
{
|
||||
public:
|
||||
PCMImportPlugin()
|
||||
: ImportPlugin(wxArrayString())
|
||||
: ImportPlugin(sf_get_all_extensions())
|
||||
{
|
||||
mExtensions = sf_get_all_extensions();
|
||||
}
|
||||
|
||||
~PCMImportPlugin() { }
|
||||
|
|
|
@ -56,6 +56,7 @@ but little else.
|
|||
#define __AUDACITY_IMPORTER__
|
||||
|
||||
#include "../Audacity.h"
|
||||
#include "audacity/Types.h"
|
||||
#include "../Internat.h"
|
||||
#include <wx/filename.h>
|
||||
#include "../MemoryX.h"
|
||||
|
@ -87,12 +88,12 @@ public:
|
|||
// Get a list of extensions this plugin expects to be able to
|
||||
// import. If a filename matches any of these extensions,
|
||||
// this importer will get first dibs on importing it.
|
||||
virtual wxArrayString GetSupportedExtensions()
|
||||
virtual FileExtensions GetSupportedExtensions()
|
||||
{
|
||||
return mExtensions;
|
||||
}
|
||||
|
||||
bool SupportsExtension(const wxString &extension)
|
||||
bool SupportsExtension(const FileExtension &extension)
|
||||
{
|
||||
// Case-insensitive check if extension is supported
|
||||
return mExtensions.Index(extension, false) != wxNOT_FOUND;
|
||||
|
@ -107,12 +108,12 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
ImportPlugin(wxArrayString supportedExtensions):
|
||||
mExtensions(supportedExtensions)
|
||||
ImportPlugin(FileExtensions supportedExtensions):
|
||||
mExtensions( std::move( supportedExtensions ) )
|
||||
{
|
||||
}
|
||||
|
||||
wxArrayString mExtensions;
|
||||
const FileExtensions mExtensions;
|
||||
};
|
||||
|
||||
|
||||
|
@ -181,9 +182,10 @@ protected:
|
|||
class UnusableImportPlugin
|
||||
{
|
||||
public:
|
||||
UnusableImportPlugin(const wxString &formatName, wxArrayString extensions):
|
||||
UnusableImportPlugin(
|
||||
const wxString &formatName, FileExtensions extensions):
|
||||
mFormatName(formatName),
|
||||
mExtensions(extensions)
|
||||
mExtensions( std::move( extensions ) )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -199,7 +201,7 @@ public:
|
|||
|
||||
private:
|
||||
wxString mFormatName;
|
||||
wxArrayString mExtensions;
|
||||
const FileExtensions mExtensions;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
|
||||
#define DESC _("QuickTime files")
|
||||
|
||||
static const wxChar *exts[] =
|
||||
{
|
||||
static const auto exts = {
|
||||
wxT("aif"),
|
||||
wxT("aifc"),
|
||||
wxT("aiff"),
|
||||
|
@ -41,8 +40,8 @@ void GetQTImportPlugin(ImportPluginList &importPluginList,
|
|||
UnusableImportPluginList &unusableImportPluginList)
|
||||
{
|
||||
unusableImportPluginList.push_back(
|
||||
std::make_unique<UnusableImportPlugin>
|
||||
(DESC, wxArrayString(WXSIZEOF(exts), exts))
|
||||
std::make_unique<UnusableImportPlugin>(DESC,
|
||||
FileExtensions( exts.begin(), exts.end() ) )
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -82,7 +81,7 @@ class QTImportPlugin final : public ImportPlugin
|
|||
{
|
||||
public:
|
||||
QTImportPlugin()
|
||||
: ImportPlugin(wxArrayString(WXSIZEOF(exts), exts)),
|
||||
: ImportPlugin( FileExtensions( exts.begin(), exts.end() ) ),
|
||||
mInitialized(false)
|
||||
{
|
||||
OSErr err = noErr;
|
||||
|
|
Loading…
Reference in New Issue