More std:: style for wxString and wxArrayString...
... Replacing: Insert => insert RemoveAt => erase Remove => erase IsSameAs => operator == or operator != (but only when second argument was true or default)
This commit is contained in:
parent
dd8eb9e3d9
commit
795b6a2e42
|
@ -852,7 +852,7 @@ void AudacityApp::OnTimer(wxTimerEvent& WXUNUSED(event))
|
|||
while (ofqueue.size()) {
|
||||
wxString name;
|
||||
name.swap(ofqueue[0]);
|
||||
ofqueue.RemoveAt(0);
|
||||
ofqueue.erase( ofqueue.begin() );
|
||||
|
||||
// Get the user's attention if no file name was specified
|
||||
if (name.empty()) {
|
||||
|
|
|
@ -905,8 +905,8 @@ void MacroCommands::AddToMacro(const wxString &command, const wxString ¶ms,
|
|||
before = (int)mCommandMacro.size();
|
||||
}
|
||||
|
||||
mCommandMacro.Insert(command, before);
|
||||
mParamsMacro.Insert(params, before);
|
||||
mCommandMacro.insert(mCommandMacro.begin() + before, command);
|
||||
mParamsMacro.insert(mParamsMacro.begin() + before, params);
|
||||
}
|
||||
|
||||
void MacroCommands::DeleteFromMacro(int index)
|
||||
|
@ -915,8 +915,8 @@ void MacroCommands::DeleteFromMacro(int index)
|
|||
return;
|
||||
}
|
||||
|
||||
mCommandMacro.RemoveAt(index);
|
||||
mParamsMacro.RemoveAt(index);
|
||||
mCommandMacro.erase( mCommandMacro.begin() + index );
|
||||
mParamsMacro.erase( mParamsMacro.begin() + index );
|
||||
}
|
||||
|
||||
void MacroCommands::ResetMacro()
|
||||
|
|
|
@ -1642,7 +1642,8 @@ bool DirManager::EnsureSafeFilename(const wxFileName &fName)
|
|||
|
||||
}
|
||||
|
||||
aliasList.Remove(fullPath);
|
||||
aliasList.erase(
|
||||
std::find( aliasList.begin(), aliasList.end(), fullPath ) );
|
||||
aliasList.push_back(renamedFullPath);
|
||||
}
|
||||
|
||||
|
|
|
@ -782,8 +782,8 @@ bool FFmpegLibs::InitLibs(const wxString &libpath_format, bool WXUNUSED(showerr)
|
|||
if (!gotError) {
|
||||
avutil_filename = FileNames::PathFromAddr(avformat->GetSymbol(wxT("avutil_version")));
|
||||
avcodec_filename = FileNames::PathFromAddr(avformat->GetSymbol(wxT("avcodec_version")));
|
||||
if (avutil_filename.GetFullPath().IsSameAs(nameFull)) {
|
||||
if (avcodec_filename.GetFullPath().IsSameAs(nameFull)) {
|
||||
if (avutil_filename.GetFullPath() == nameFull) {
|
||||
if (avcodec_filename.GetFullPath() == nameFull) {
|
||||
util = avformat.get();
|
||||
codec = avformat.get();
|
||||
}
|
||||
|
|
|
@ -1877,7 +1877,7 @@ bool LabelTrack::OnKeyDown(SelectedRegion &newSel, wxKeyEvent & event)
|
|||
{
|
||||
// DELETE one letter
|
||||
if (mCurrentCursorPos > 0) {
|
||||
title.Remove(mCurrentCursorPos-1, 1);
|
||||
title.erase(mCurrentCursorPos-1, 1);
|
||||
mCurrentCursorPos--;
|
||||
}
|
||||
}
|
||||
|
@ -1907,7 +1907,7 @@ bool LabelTrack::OnKeyDown(SelectedRegion &newSel, wxKeyEvent & event)
|
|||
{
|
||||
// DELETE one letter
|
||||
if (mCurrentCursorPos < len) {
|
||||
title.Remove(mCurrentCursorPos, 1);
|
||||
title.erase(mCurrentCursorPos, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ bool Module::Load()
|
|||
}
|
||||
|
||||
wxString moduleVersion = versionFn();
|
||||
if( !moduleVersion.IsSameAs(AUDACITY_VERSION_STRING)) {
|
||||
if( moduleVersion != AUDACITY_VERSION_STRING) {
|
||||
wxString ShortName = wxFileName( mName ).GetName();
|
||||
AudacityMessageBox(wxString::Format(_("The module %s is matched with Audacity version %s.\n\nIt will not be loaded."), ShortName, moduleVersion), _("Module Unsuitable"));
|
||||
wxLogMessage(wxString::Format(_("The module %s is matched with Audacity version %s. It will not be loaded."), mName, moduleVersion));
|
||||
|
|
|
@ -1405,7 +1405,7 @@ bool PluginManager::IsPluginRegistered(const wxString & path)
|
|||
{
|
||||
for (PluginMap::iterator iter = mPlugins.begin(); iter != mPlugins.end(); ++iter)
|
||||
{
|
||||
if (iter->second.GetPath().IsSameAs(path))
|
||||
if (iter->second.GetPath() == path)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -2124,17 +2124,17 @@ void PluginManager::LoadGroup(wxFileConfig *pRegistry, PluginType type)
|
|||
if (!pRegistry->Read(KEY_EFFECTTYPE, &strVal))
|
||||
continue;
|
||||
|
||||
if (strVal.IsSameAs(KEY_EFFECTTYPE_NONE))
|
||||
if (strVal == KEY_EFFECTTYPE_NONE)
|
||||
plug.SetEffectType(EffectTypeNone);
|
||||
else if (strVal.IsSameAs(KEY_EFFECTTYPE_ANALYZE))
|
||||
else if (strVal == KEY_EFFECTTYPE_ANALYZE)
|
||||
plug.SetEffectType(EffectTypeAnalyze);
|
||||
else if (strVal.IsSameAs(KEY_EFFECTTYPE_GENERATE))
|
||||
else if (strVal == KEY_EFFECTTYPE_GENERATE)
|
||||
plug.SetEffectType(EffectTypeGenerate);
|
||||
else if (strVal.IsSameAs(KEY_EFFECTTYPE_PROCESS))
|
||||
else if (strVal == KEY_EFFECTTYPE_PROCESS)
|
||||
plug.SetEffectType(EffectTypeProcess);
|
||||
else if (strVal.IsSameAs(KEY_EFFECTTYPE_TOOL))
|
||||
else if (strVal == KEY_EFFECTTYPE_TOOL)
|
||||
plug.SetEffectType(EffectTypeTool);
|
||||
else if (strVal.IsSameAs(KEY_EFFECTTYPE_HIDDEN))
|
||||
else if (strVal == KEY_EFFECTTYPE_HIDDEN)
|
||||
plug.SetEffectType(EffectTypeHidden);
|
||||
else
|
||||
continue;
|
||||
|
|
|
@ -194,7 +194,7 @@ bool Shuttle::TransferEnum( const wxString & Name, int & iValue,
|
|||
|
||||
for( int i = 0; i < nChoices; i++ )
|
||||
{
|
||||
if( str.IsSameAs( pFirstStr[i] ))
|
||||
if( str == pFirstStr[i] )
|
||||
{
|
||||
iValue = i;
|
||||
break;
|
||||
|
|
|
@ -484,7 +484,7 @@ void Tags::SetTag(const wxString & name, const wxString & value)
|
|||
mXref[key] = name;
|
||||
mMap[name] = value;
|
||||
}
|
||||
else if (!iter->second.IsSameAs(name)) {
|
||||
else if (iter->second != name) {
|
||||
// Watch out for case differences!
|
||||
mMap[name] = value;
|
||||
mMap.erase(iter->second);
|
||||
|
|
|
@ -3994,7 +3994,7 @@ void EffectPresetsDialog::SetPrefix(const wxString & type, const wxString & pref
|
|||
{
|
||||
mType->SetStringSelection(type);
|
||||
|
||||
if (type.IsSameAs(_("User Presets")))
|
||||
if (type == _("User Presets"))
|
||||
{
|
||||
mPresets->Clear();
|
||||
mPresets->Append(mUserPresets);
|
||||
|
@ -4006,7 +4006,7 @@ void EffectPresetsDialog::SetPrefix(const wxString & type, const wxString & pref
|
|||
}
|
||||
mSelection = Effect::kUserPresetIdent + mPresets->GetStringSelection();
|
||||
}
|
||||
else if (type.IsSameAs(_("Factory Presets")))
|
||||
else if (type == _("Factory Presets"))
|
||||
{
|
||||
mPresets->Clear();
|
||||
for (size_t i = 0, cnt = mFactoryPresets.size(); i < cnt; i++)
|
||||
|
@ -4026,13 +4026,13 @@ void EffectPresetsDialog::SetPrefix(const wxString & type, const wxString & pref
|
|||
}
|
||||
mSelection = Effect::kFactoryPresetIdent + mPresets->GetStringSelection();
|
||||
}
|
||||
else if (type.IsSameAs(_("Current Settings")))
|
||||
else if (type == _("Current Settings"))
|
||||
{
|
||||
mPresets->Clear();
|
||||
mPresets->Enable(false);
|
||||
mSelection = Effect::kCurrentSettingsIdent;
|
||||
}
|
||||
else if (type.IsSameAs(_("Factory Defaults")))
|
||||
else if (type == _("Factory Defaults"))
|
||||
{
|
||||
mPresets->Clear();
|
||||
mPresets->Enable(false);
|
||||
|
@ -4050,7 +4050,7 @@ void EffectPresetsDialog::UpdateUI()
|
|||
}
|
||||
wxString type = mType->GetString(selected);
|
||||
|
||||
if (type.IsSameAs(_("User Presets")))
|
||||
if (type == _("User Presets"))
|
||||
{
|
||||
selected = mPresets->GetSelection();
|
||||
if (selected == wxNOT_FOUND)
|
||||
|
@ -4064,7 +4064,7 @@ void EffectPresetsDialog::UpdateUI()
|
|||
mPresets->SetSelection(selected);
|
||||
mSelection = Effect::kUserPresetIdent + mPresets->GetString(selected);
|
||||
}
|
||||
else if (type.IsSameAs(_("Factory Presets")))
|
||||
else if (type == _("Factory Presets"))
|
||||
{
|
||||
selected = mPresets->GetSelection();
|
||||
if (selected == wxNOT_FOUND)
|
||||
|
@ -4086,13 +4086,13 @@ void EffectPresetsDialog::UpdateUI()
|
|||
mPresets->SetSelection(selected);
|
||||
mSelection = Effect::kFactoryPresetIdent + mPresets->GetString(selected);
|
||||
}
|
||||
else if (type.IsSameAs(_("Current Settings")))
|
||||
else if (type == _("Current Settings"))
|
||||
{
|
||||
mPresets->Clear();
|
||||
mPresets->Enable(false);
|
||||
mSelection = Effect::kCurrentSettingsIdent;
|
||||
}
|
||||
else if (type.IsSameAs(_("Factory Defaults")))
|
||||
else if (type == _("Factory Defaults"))
|
||||
{
|
||||
mPresets->Clear();
|
||||
mPresets->Enable(false);
|
||||
|
|
|
@ -367,7 +367,7 @@ bool EffectEqualization::ValidateUI()
|
|||
// If editing a macro, we don't want to be using the unnamed curve so
|
||||
// we offer to save it.
|
||||
|
||||
if (mDisallowCustom && mCurveName.IsSameAs(wxT("unnamed")))
|
||||
if (mDisallowCustom && mCurveName == wxT("unnamed"))
|
||||
{
|
||||
// PRL: This is unreachable. mDisallowCustom is always false.
|
||||
|
||||
|
@ -3338,7 +3338,7 @@ void EditCurvesDialog::OnRename(wxCommandEvent & WXUNUSED(event))
|
|||
for( curve = 0; curve < numCurves; curve++ )
|
||||
{
|
||||
wxString temp = mEditCurves[ curve ].Name;
|
||||
if( name.IsSameAs( mEditCurves[ curve ].Name )) // case sensitive
|
||||
if( name == mEditCurves[ curve ].Name ) // case sensitive
|
||||
{
|
||||
bad = true;
|
||||
if( curve == item ) // trying to rename a curve with the same name
|
||||
|
|
|
@ -417,7 +417,7 @@ wxArrayString VSTEffectsModule::FindPluginPaths(PluginManagerInterface & pm)
|
|||
files[i] = wxPathOnly(wxPathOnly(files[i]));
|
||||
if (!files[i].EndsWith(wxT(".vst")))
|
||||
{
|
||||
files.RemoveAt(i--);
|
||||
files.erase( files.begin() + i-- );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -619,12 +619,12 @@ unsigned VSTEffectsModule::DiscoverPluginsAtPath(
|
|||
break;
|
||||
|
||||
case kKeyInteractive:
|
||||
proc.mInteractive = val.IsSameAs(wxT("1"));
|
||||
proc.mInteractive = val == wxT("1");
|
||||
keycount++;
|
||||
break;
|
||||
|
||||
case kKeyAutomatable:
|
||||
proc.mAutomatable = val.IsSameAs(wxT("1"));
|
||||
proc.mAutomatable = val == wxT("1");
|
||||
keycount++;
|
||||
break;
|
||||
|
||||
|
|
|
@ -2103,7 +2103,7 @@ void LV2Effect::SetPortValue(const char *port_symbol,
|
|||
|
||||
for (size_t p = 0, cnt = mControls.size(); p < cnt; p++)
|
||||
{
|
||||
if (mControls[p].mSymbol.IsSameAs(symbol))
|
||||
if (mControls[p].mSymbol == symbol)
|
||||
{
|
||||
if (type == Bool && size == sizeof(bool))
|
||||
{
|
||||
|
|
|
@ -1818,7 +1818,9 @@ void ExportFFmpegOptions::OnDeletePreset(wxCommandEvent& WXUNUSED(event))
|
|||
long index = preset->FindString(presetname);
|
||||
preset->SetValue(wxEmptyString);
|
||||
preset->Delete(index);
|
||||
mPresetNames.Remove(presetname);
|
||||
mPresetNames.erase(
|
||||
std::find( mPresetNames.begin(), mPresetNames.end(), presetname )
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
|
|
|
@ -389,8 +389,8 @@ ExportPCM::ExportPCM()
|
|||
#if defined(wxMSW)
|
||||
// On Windows make sure WAV is at the beginning of the list of all possible
|
||||
// extensions for this format
|
||||
allext.Remove(wavext);
|
||||
allext.Insert(wavext, 0);
|
||||
allext.erase( std::find( allext.begin(), allext.end(), wavext ) );
|
||||
allext.insert(allext.begin(), wavext);
|
||||
#endif
|
||||
SetExtensions(allext, format);
|
||||
SetMaxChannels(255, format);
|
||||
|
|
|
@ -236,7 +236,9 @@ void Importer::ReadImportItems()
|
|||
int index = new_item->divider;
|
||||
if (new_item->divider < 0)
|
||||
index = new_item->filters.size();
|
||||
new_item->filters.Insert(importPlugin->GetPluginStringID(),index);
|
||||
new_item->filters.insert(
|
||||
new_item->filters.begin() + index,
|
||||
importPlugin->GetPluginStringID());
|
||||
new_item->filter_objects.insert(
|
||||
new_item->filter_objects.begin() + index, importPlugin.get());
|
||||
if (new_item->divider >= 0)
|
||||
|
@ -454,7 +456,7 @@ bool Importer::Import(const wxString &fName,
|
|||
// in case subsequent code revisions to the constructor should break this assumption that
|
||||
// libsndfile is first.
|
||||
ImportPlugin *libsndfilePlugin = mImportPluginList.begin()->get();
|
||||
wxASSERT(libsndfilePlugin->GetPluginStringID().IsSameAs(wxT("libsndfile")));
|
||||
wxASSERT(libsndfilePlugin->GetPluginStringID() == wxT("libsndfile"));
|
||||
|
||||
for (const auto &plugin : mImportPluginList)
|
||||
{
|
||||
|
@ -472,7 +474,7 @@ bool Importer::Import(const wxString &fName,
|
|||
// but then get processed as desired by libmad.
|
||||
// But a wav file which bears an incorrect .mp3 extension will be successfully
|
||||
// processed by libsndfile and thus avoid being submitted to libmad.
|
||||
if (plugin->GetPluginStringID().IsSameAs(wxT("libmad")))
|
||||
if (plugin->GetPluginStringID() == wxT("libmad"))
|
||||
{
|
||||
// Make sure libsndfile is not already in the list
|
||||
if (importPlugins.end() ==
|
||||
|
@ -494,7 +496,7 @@ bool Importer::Import(const wxString &fName,
|
|||
// formats unsuitable for it, and produce distorted results.
|
||||
for (const auto &plugin : mImportPluginList)
|
||||
{
|
||||
if (!(plugin->GetPluginStringID().IsSameAs(wxT("libmad"))))
|
||||
if (!(plugin->GetPluginStringID() == wxT("libmad")))
|
||||
{
|
||||
// Make sure its not already in the list
|
||||
if (importPlugins.end() ==
|
||||
|
|
|
@ -344,7 +344,7 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln)
|
|||
}
|
||||
} // End if statement
|
||||
|
||||
if (tokenholder.IsSameAs(wxT("#")))
|
||||
if (tokenholder == wxT("#"))
|
||||
{
|
||||
// # indicates comments; ignore line
|
||||
tok = wxStringTokenizer(wxT(""), wxT(" "));
|
||||
|
@ -399,7 +399,7 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln)
|
|||
{
|
||||
tokenholder = tok.GetNextToken();
|
||||
|
||||
if (tokenholder.IsSameAs(wxT("#")))
|
||||
if (tokenholder == wxT("#"))
|
||||
{
|
||||
// # indicates comments; ignore line
|
||||
tok = wxStringTokenizer(wxT(""), wxT(" "));
|
||||
|
@ -453,7 +453,7 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln)
|
|||
} // End if statement (more tokens after file name)
|
||||
} // End if statement "file" lines
|
||||
|
||||
else if (tokenholder.IsSameAs(wxT("#")))
|
||||
else if (tokenholder == wxT("#"))
|
||||
{
|
||||
// # indicates comments; ignore line
|
||||
tok = wxStringTokenizer(wxT(""), wxT(" "));
|
||||
|
|
|
@ -723,7 +723,7 @@ void AddEffectMenuItemGroup(
|
|||
int groupCnt = namesCnt;
|
||||
for (int i = 0; i < namesCnt; i++)
|
||||
{
|
||||
while (i + 1 < namesCnt && names[i].IsSameAs(names[i + 1]))
|
||||
while (i + 1 < namesCnt && names[i] == names[i + 1])
|
||||
{
|
||||
i++;
|
||||
groupCnt--;
|
||||
|
@ -757,12 +757,12 @@ void AddEffectMenuItemGroup(
|
|||
pTable = &temp1;
|
||||
}
|
||||
|
||||
if (i + 1 < namesCnt && names[i].IsSameAs(names[i + 1]))
|
||||
if (i + 1 < namesCnt && names[i] == names[i + 1])
|
||||
{
|
||||
// collect a sub-menu for like-named items
|
||||
const wxString name = names[i];
|
||||
BaseItemPtrs temp2;
|
||||
while (i < namesCnt && names[i].IsSameAs(name))
|
||||
while (i < namesCnt && names[i] == name)
|
||||
{
|
||||
const PluginDescriptor *plug =
|
||||
PluginManager::Get().GetPlugin(plugs[i]);
|
||||
|
|
|
@ -202,7 +202,7 @@ void MidiIOPrefs::OnHost(wxCommandEvent & WXUNUSED(e))
|
|||
for (int i = 0; i < nDevices; i++) {
|
||||
const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
|
||||
wxString interf = wxSafeConvertMB2WX(info->interf);
|
||||
if (itemAtIndex.IsSameAs(interf)) {
|
||||
if (itemAtIndex == interf) {
|
||||
wxString name = wxSafeConvertMB2WX(info->name);
|
||||
wxString device = wxString::Format(wxT("%s: %s"),
|
||||
interf,
|
||||
|
|
|
@ -48,14 +48,14 @@ void FileHistory::AddFileToHistory(const wxString & file, bool update)
|
|||
#endif
|
||||
|
||||
if (i != wxNOT_FOUND) {
|
||||
mHistory.RemoveAt(i);
|
||||
mHistory.erase( mHistory.begin() + i );
|
||||
}
|
||||
|
||||
if (mMaxFiles == mHistory.size()) {
|
||||
mHistory.RemoveAt(mHistory.size() - 1);
|
||||
if (mMaxFiles > 0 && mMaxFiles == mHistory.size()) {
|
||||
mHistory.erase( mHistory.end() - 1 );
|
||||
}
|
||||
|
||||
mHistory.Insert(file, 0);
|
||||
mHistory.insert(mHistory.begin(), file);
|
||||
|
||||
if (update) {
|
||||
AddFilesToMenu();
|
||||
|
@ -67,7 +67,7 @@ void FileHistory::RemoveFileFromHistory(size_t i, bool update)
|
|||
wxASSERT(i < mHistory.size());
|
||||
|
||||
if (i < mHistory.size()) {
|
||||
mHistory.RemoveAt(i);
|
||||
mHistory.erase( mHistory.begin() + i );
|
||||
|
||||
if (update) {
|
||||
AddFilesToMenu();
|
||||
|
|
|
@ -778,9 +778,9 @@ KeyView::RefreshLines(bool bSort)
|
|||
// For the Key View, if the filter is a single character,
|
||||
// then it has to be the last character in the searchit string,
|
||||
// and be preceded by nothing or +.
|
||||
if ((mViewType == ViewByKey) &&
|
||||
if ((mViewType == ViewByKey) &&
|
||||
(mFilter.length() == 1) &&
|
||||
(!mFilter.IsSameAs(searchit.Last()) ||
|
||||
(mFilter != searchit.Last() ||
|
||||
((searchit.length() > 1) &&
|
||||
((wxString)(searchit.GetChar(searchit.length() - 2)) != wxT("+")))))
|
||||
{
|
||||
|
|
|
@ -91,7 +91,7 @@ void XMLWriter::StartTag(const wxString &name)
|
|||
|
||||
Write(wxString::Format(wxT("<%s"), name));
|
||||
|
||||
mTagstack.Insert(name, 0);
|
||||
mTagstack.insert(mTagstack.begin(), name);
|
||||
mHasKids[0] = true;
|
||||
mHasKids.insert(mHasKids.begin(), false);
|
||||
mDepth++;
|
||||
|
@ -119,7 +119,7 @@ void XMLWriter::EndTag(const wxString &name)
|
|||
else {
|
||||
Write(wxT(">\n"));
|
||||
}
|
||||
mTagstack.RemoveAt(0);
|
||||
mTagstack.erase( mTagstack.begin() );
|
||||
mHasKids.erase(mHasKids.begin());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue