Some replacements of wxArrayString with auto

This commit is contained in:
Paul Licameli 2019-02-12 14:00:23 -05:00
parent e46990f709
commit da33daf197
16 changed files with 25 additions and 25 deletions

View File

@ -288,7 +288,7 @@ public:
{ {
wxFileConfig::SetPath(wxT("/")); wxFileConfig::SetPath(wxT("/"));
wxArrayString parsed = wxCmdLineParser::ConvertStringToArgs(parms); auto parsed = wxCmdLineParser::ConvertStringToArgs(parms);
for (size_t i = 0, cnt = parsed.size(); i < cnt; i++) for (size_t i = 0, cnt = parsed.size(); i < cnt; i++)
{ {

View File

@ -93,8 +93,8 @@ MacroCommands::MacroCommands()
mMessage = ""; mMessage = "";
ResetMacro(); ResetMacro();
wxArrayString names = GetNames(); auto names = GetNames();
wxArrayString defaults = GetNamesOfDefaultMacros(); auto defaults = GetNamesOfDefaultMacros();
for( size_t i = 0;i<defaults.size();i++){ for( size_t i = 0;i<defaults.size();i++){
wxString name = defaults[i]; wxString name = defaults[i];
@ -1004,7 +1004,7 @@ wxArrayString MacroCommands::GetNames()
bool MacroCommands::IsFixed(const wxString & name) bool MacroCommands::IsFixed(const wxString & name)
{ {
wxArrayString defaults = GetNamesOfDefaultMacros(); auto defaults = GetNamesOfDefaultMacros();
if( make_iterator_range( defaults ).contains( name ) ) if( make_iterator_range( defaults ).contains( name ) )
return true; return true;
return false; return false;

View File

@ -170,7 +170,7 @@ void ApplyMacroDialog::PopulateOrExchange(ShuttleGui &S)
/// a shared function. /// a shared function.
void ApplyMacroDialog::PopulateMacros() void ApplyMacroDialog::PopulateMacros()
{ {
wxArrayString names = mMacroCommands.GetNames(); auto names = mMacroCommands.GetNames();
int i; int i;
int topItem = mMacros->GetTopItem(); int topItem = mMacros->GetTopItem();

View File

@ -514,7 +514,7 @@ void ModuleManager::FindAllPlugins(PluginIDList & providers, wxArrayString & pat
if (!module) if (!module)
continue; continue;
wxArrayString newpaths = module->FindPluginPaths(pm); auto newpaths = module->FindPluginPaths(pm);
for (size_t j = 0, cntPaths = newpaths.size(); j < cntPaths; j++) for (size_t j = 0, cntPaths = newpaths.size(); j < cntPaths; j++)
{ {
providers.push_back(providerID); providers.push_back(providerID);

View File

@ -2328,7 +2328,7 @@ void PluginManager::SaveGroup(wxFileConfig *pRegistry, PluginType type)
{ {
pRegistry->Write(KEY_IMPORTERIDENT, plug.GetImporterIdentifier()); pRegistry->Write(KEY_IMPORTERIDENT, plug.GetImporterIdentifier());
pRegistry->Write(KEY_IMPORTERFILTER, plug.GetImporterFilterDescription()); pRegistry->Write(KEY_IMPORTERFILTER, plug.GetImporterFilterDescription());
const wxArrayString & extensions = plug.GetImporterExtensions(); const auto & extensions = plug.GetImporterExtensions();
wxString strExt; wxString strExt;
for (size_t i = 0, cnt = extensions.size(); i < cnt; i++) for (size_t i = 0, cnt = extensions.size(); i < cnt; i++)
{ {
@ -2407,7 +2407,7 @@ void PluginManager::CheckForUpdates(bool bFast)
else else
{ {
// Collect plugin paths // Collect plugin paths
wxArrayString paths = mm.FindPluginsForProvider(plugID, plugPath); auto paths = mm.FindPluginsForProvider(plugID, plugPath);
for (size_t i = 0, cnt = paths.size(); i < cnt; i++) for (size_t i = 0, cnt = paths.size(); i < cnt; i++)
{ {
wxString path = paths[i].BeforeFirst(wxT(';'));; wxString path = paths[i].BeforeFirst(wxT(';'));;

View File

@ -2879,7 +2879,7 @@ void AudacityProject::OpenFiles(AudacityProject *proj)
* and save dialogues, for the option that only shows project files created * and save dialogues, for the option that only shows project files created
* with Audacity. Do not include pipe symbols or .aup (this extension will * with Audacity. Do not include pipe symbols or .aup (this extension will
* now be added automatically for the Save Projects dialogues).*/ * now be added automatically for the Save Projects dialogues).*/
wxArrayString selectedFiles = ShowOpenDialog(_("Audacity projects"), wxT("*.aup")); auto selectedFiles = ShowOpenDialog(_("Audacity projects"), wxT("*.aup"));
if (selectedFiles.size() == 0) { if (selectedFiles.size() == 0) {
gPrefs->Write(wxT("/LastOpenType"),wxT("")); gPrefs->Write(wxT("/LastOpenType"),wxT(""));
gPrefs->Flush(); gPrefs->Flush();

View File

@ -868,7 +868,7 @@ void TagsEditor::PopulateOrExchange(ShuttleGui & S)
mGrid->SetColLabelSize(mGrid->GetDefaultRowSize()); mGrid->SetColLabelSize(mGrid->GetDefaultRowSize());
wxArrayString cs(names()); auto cs = names();
// Build the initial (empty) grid // Build the initial (empty) grid
mGrid->CreateGrid(0, 2); mGrid->CreateGrid(0, 2);

View File

@ -1038,7 +1038,7 @@ bool Effect::SetAutomationParameters(const wxString & parms)
else if (preset.StartsWith(kFactoryPresetIdent)) else if (preset.StartsWith(kFactoryPresetIdent))
{ {
preset.Replace(kFactoryPresetIdent, wxEmptyString, false); preset.Replace(kFactoryPresetIdent, wxEmptyString, false);
wxArrayString presets = GetFactoryPresets(); auto presets = GetFactoryPresets();
success = LoadFactoryPreset( make_iterator_range( presets ).index( preset ) ); success = LoadFactoryPreset( make_iterator_range( presets ).index( preset ) );
} }
else if (preset.StartsWith(kCurrentSettingsIdent)) else if (preset.StartsWith(kCurrentSettingsIdent))
@ -3376,7 +3376,7 @@ void EffectUIHost::OnMenu(wxCommandEvent & WXUNUSED(evt))
menu.AppendSeparator(); menu.AppendSeparator();
wxArrayString factory = mEffect->GetFactoryPresets(); auto factory = mEffect->GetFactoryPresets();
{ {
auto sub = std::make_unique<wxMenu>(); auto sub = std::make_unique<wxMenu>();

View File

@ -128,7 +128,7 @@ wxString NyquistEffectsModule::GetDescription()
bool NyquistEffectsModule::Initialize() bool NyquistEffectsModule::Initialize()
{ {
wxArrayString audacityPathList = wxGetApp().audacityPathList; auto audacityPathList = wxGetApp().audacityPathList;
for (size_t i = 0, cnt = audacityPathList.size(); i < cnt; i++) for (size_t i = 0, cnt = audacityPathList.size(); i < cnt; i++)
{ {
@ -203,7 +203,7 @@ bool NyquistEffectsModule::AutoRegisterPlugins(PluginManagerInterface & pm)
wxArrayString NyquistEffectsModule::FindPluginPaths(PluginManagerInterface & pm) wxArrayString NyquistEffectsModule::FindPluginPaths(PluginManagerInterface & pm)
{ {
wxArrayString pathList = NyquistEffect::GetNyquistSearchPath(); auto pathList = NyquistEffect::GetNyquistSearchPath();
wxArrayString files; wxArrayString files;
// Add the Nyquist prompt // Add the Nyquist prompt

View File

@ -235,7 +235,7 @@ wxString NyquistEffect::ManualPage()
wxString NyquistEffect::HelpPage() wxString NyquistEffect::HelpPage()
{ {
wxArrayString paths = NyquistEffect::GetNyquistSearchPath(); auto paths = NyquistEffect::GetNyquistSearchPath();
wxString fileName; wxString fileName;
for (size_t i = 0, cnt = paths.size(); i < cnt; i++) { for (size_t i = 0, cnt = paths.size(); i < cnt; i++) {
@ -662,7 +662,7 @@ bool NyquistEffect::Process()
mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'DOCUMENTS)\n"), EscapeString(wxStandardPaths::Get().GetDocumentsDir())); mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'DOCUMENTS)\n"), EscapeString(wxStandardPaths::Get().GetDocumentsDir()));
mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'HOME)\n"), EscapeString(wxGetHomeDir())); mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'HOME)\n"), EscapeString(wxGetHomeDir()));
wxArrayString paths = NyquistEffect::GetNyquistSearchPath(); auto paths = NyquistEffect::GetNyquistSearchPath();
wxString list; wxString list;
for (size_t i = 0, cnt = paths.size(); i < cnt; i++) for (size_t i = 0, cnt = paths.size(); i < cnt; i++)
{ {
@ -2343,7 +2343,7 @@ void NyquistEffect::OSCallback()
wxArrayString NyquistEffect::GetNyquistSearchPath() wxArrayString NyquistEffect::GetNyquistSearchPath()
{ {
wxArrayString audacityPathList = wxGetApp().audacityPathList; auto audacityPathList = wxGetApp().audacityPathList;
wxArrayString pathList; wxArrayString pathList;
for (size_t i = 0; i < audacityPathList.size(); i++) for (size_t i = 0; i < audacityPathList.size(); i++)

View File

@ -178,7 +178,7 @@ wxString ExportPlugin::GetMask(int index)
// Build the mask // Build the mask
// wxString ext = GetExtension(index); // wxString ext = GetExtension(index);
wxArrayString exts = GetExtensions(index); auto exts = GetExtensions(index);
for (size_t i = 0; i < exts.size(); i++) { for (size_t i = 0; i < exts.size(); i++) {
mask += wxT("*.") + exts[i] + wxT(";"); mask += wxT("*.") + exts[i] + wxT(";");
} }
@ -202,7 +202,7 @@ bool ExportPlugin::IsExtension(const wxString & ext, int index)
for (int i = index; i < GetFormatCount(); i = GetFormatCount()) for (int i = index; i < GetFormatCount(); i = GetFormatCount())
{ {
wxString defext = GetExtension(i); wxString defext = GetExtension(i);
wxArrayString defexts = GetExtensions(i); auto defexts = GetExtensions(i);
int indofext = defexts.Index(ext, false); int indofext = defexts.Index(ext, false);
if (defext == wxT("") || (indofext != wxNOT_FOUND)) if (defext == wxT("") || (indofext != wxNOT_FOUND))
isext = true; isext = true;

View File

@ -384,7 +384,7 @@ ExportPCM::ExportPCM()
SetFormat(wxT("LIBSNDFILE"), format); SetFormat(wxT("LIBSNDFILE"), format);
SetCanMetaData(true, format); SetCanMetaData(true, format);
SetDescription(_("Other uncompressed files"), format); SetDescription(_("Other uncompressed files"), format);
wxArrayString allext = sf_get_all_extensions(); auto allext = sf_get_all_extensions();
wxString wavext = sf_header_extension(SF_FORMAT_WAV); // get WAV ext. wxString wavext = sf_header_extension(SF_FORMAT_WAV); // get WAV ext.
#if defined(wxMSW) #if defined(wxMSW)
// On Windows make sure WAV is at the beginning of the list of all possible // On Windows make sure WAV is at the beginning of the list of all possible

View File

@ -824,7 +824,7 @@ void AddEffectMenuItemGroup(
MenuTable::BaseItemPtrs PopulateMacrosMenu( CommandFlag flags ) MenuTable::BaseItemPtrs PopulateMacrosMenu( CommandFlag flags )
{ {
MenuTable::BaseItemPtrs result; MenuTable::BaseItemPtrs result;
wxArrayString names = MacroCommands::GetNames(); auto names = MacroCommands::GetNames();
int i; int i;
for (i = 0; i < (int)names.size(); i++) { for (i = 0; i < (int)names.size(); i++) {

View File

@ -162,7 +162,7 @@ void DirectoriesPrefs::OnChooseTempDir(wxCommandEvent & e)
#else #else
newDirName = wxT(".audacity_temp"); newDirName = wxT(".audacity_temp");
#endif #endif
wxArrayString dirsInPath = tmpDirPath.GetDirs(); auto dirsInPath = tmpDirPath.GetDirs();
// If the default temp dir or user's pref dir don't end in '/' they cause // If the default temp dir or user's pref dir don't end in '/' they cause
// wxFileName's == operator to construct a wxFileName representing a file // wxFileName's == operator to construct a wxFileName representing a file

View File

@ -810,7 +810,7 @@ void DeviceToolBar::ShowComboDialog(wxChoice *combo, const wxString &title)
} }
#if USE_PORTMIXER #if USE_PORTMIXER
wxArrayString inputSources = combo->GetStrings(); auto inputSources = combo->GetStrings();
wxDialogWrapper dlg(nullptr, wxID_ANY, title); wxDialogWrapper dlg(nullptr, wxID_ANY, title);
dlg.SetName(dlg.GetTitle()); dlg.SetName(dlg.GetTitle());

View File

@ -451,7 +451,7 @@ BEGIN_POPUP_MENU(WaveformVRulerMenuTable)
#if 0 #if 0
POPUP_MENU_SEPARATOR() POPUP_MENU_SEPARATOR()
{ {
const wxArrayString & names = WaveformSettings::GetScaleNames(); const auto & names = WaveformSettings::GetScaleNames();
for (int ii = 0, nn = names.size(); ii < nn; ++ii) { for (int ii = 0, nn = names.size(); ii < nn; ++ii) {
POPUP_MENU_RADIO_ITEM(OnFirstWaveformScaleID + ii, names[ii], POPUP_MENU_RADIO_ITEM(OnFirstWaveformScaleID + ii, names[ii],
OnWaveformScaleType); OnWaveformScaleType);
@ -520,7 +520,7 @@ void SpectrumVRulerMenuTable::InitMenu(Menu *pMenu, void *pUserData)
BEGIN_POPUP_MENU(SpectrumVRulerMenuTable) BEGIN_POPUP_MENU(SpectrumVRulerMenuTable)
{ {
const wxArrayString & names = SpectrogramSettings::GetScaleNames(); const auto & names = SpectrogramSettings::GetScaleNames();
for (int ii = 0, nn = names.size(); ii < nn; ++ii) { for (int ii = 0, nn = names.size(); ii < nn; ++ii) {
POPUP_MENU_RADIO_ITEM(OnFirstSpectrumScaleID + ii, names[ii], POPUP_MENU_RADIO_ITEM(OnFirstSpectrumScaleID + ii, names[ii],
OnSpectrumScaleType); OnSpectrumScaleType);