More range-based loops and overrides

This commit is contained in:
Tillmann Karras
2014-03-11 06:55:00 +01:00
parent 3fc9ca0789
commit 2fcaca0603
18 changed files with 110 additions and 127 deletions

View File

@ -547,12 +547,9 @@ void CheatSearchTab::UpdateCheatSearchResultsList()
}
else
{
std::vector<CheatSearchResult>::const_iterator
i = search_results.begin(),
e = search_results.end();
for (; i!=e; ++i)
for (const CheatSearchResult& result : search_results)
{
u32 display_value = i->old_value;
u32 display_value = result.old_value;
// #ifdef LIL_ENDIAN :p
switch (search_type_size)
@ -574,7 +571,7 @@ void CheatSearchTab::UpdateCheatSearchResultsList()
rowfmt[14] = (wxChar)(wxT('0') + search_type_size*2);
lbox_search_results->Append(
wxString::Format(rowfmt, i->address, display_value, display_value, display_value));
wxString::Format(rowfmt, result.address, display_value, display_value, display_value));
}
}

View File

@ -88,14 +88,13 @@ void CodeConfigPanel::UpdateCodeList(bool checkRunning)
m_listbox_gcodes->Clear();
// add the codes to the listbox
std::vector<GeckoCode>::const_iterator
gcodes_iter = m_gcodes.begin(),
gcodes_end = m_gcodes.end();
for (; gcodes_iter!=gcodes_end; ++gcodes_iter)
for (const GeckoCode& code : m_gcodes)
{
m_listbox_gcodes->Append(StrToWxStr(gcodes_iter->name));
if (gcodes_iter->enabled)
m_listbox_gcodes->Append(StrToWxStr(code.name));
if (code.enabled)
{
m_listbox_gcodes->Check(m_listbox_gcodes->GetCount()-1, true);
}
}
wxCommandEvent evt;
@ -131,21 +130,19 @@ void CodeConfigPanel::UpdateInfoBox(wxCommandEvent&)
// notes textctrl
m_infobox.textctrl_notes->Clear();
std::vector<std::string>::const_iterator
notes_iter = m_gcodes[sel].notes.begin(),
notes_end = m_gcodes[sel].notes.end();
for (; notes_iter!=notes_end; ++notes_iter)
m_infobox.textctrl_notes->AppendText(StrToWxStr(*notes_iter));
for (const std::string& note : m_gcodes[sel].notes)
{
m_infobox.textctrl_notes->AppendText(StrToWxStr(note));
}
m_infobox.textctrl_notes->ScrollLines(-99); // silly
m_infobox.label_creator->SetLabel(wxGetTranslation(wxstr_creator) + StrToWxStr(m_gcodes[sel].creator));
// add codes to info listbox
std::vector<GeckoCode::Code>::const_iterator
codes_iter = m_gcodes[sel].codes.begin(),
codes_end = m_gcodes[sel].codes.end();
for (; codes_iter!=codes_end; ++codes_iter)
m_infobox.listbox_codes->Append(wxString::Format(wxT("%08X %08X"), codes_iter->address, codes_iter->data));
for (const GeckoCode::Code& code : m_gcodes[sel].codes)
{
m_infobox.listbox_codes->Append(wxString::Format(wxT("%08X %08X"), code.address, code.data));
}
}
else
{
@ -281,10 +278,7 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&)
unsigned long added_count = 0;
// append the codes to the code list
std::vector<GeckoCode>::const_iterator
gcodes_iter = gcodes.begin(),
gcodes_end = gcodes.end();
for (; gcodes_iter!= gcodes_end; ++gcodes_iter)
for (const GeckoCode& code : gcodes)
{
// only add codes which do not already exist
std::vector<GeckoCode>::const_iterator
@ -294,13 +288,13 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&)
{
if (existing_gcodes_end == existing_gcodes_iter)
{
m_gcodes.push_back(*gcodes_iter);
m_gcodes.push_back(code);
++added_count;
break;
}
// code exists
if (existing_gcodes_iter->Compare(*gcodes_iter))
if (existing_gcodes_iter->Compare(code))
break;
}
}

View File

@ -235,11 +235,10 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
choice_backend = new wxChoice(page_general, wxID_ANY);
RegisterControl(choice_backend, wxGetTranslation(backend_desc));
std::vector<VideoBackend*>::const_iterator
it = g_available_video_backends.begin(),
itend = g_available_video_backends.end();
for (; it != itend; ++it)
choice_backend->AppendString(wxGetTranslation(StrToWxStr((*it)->GetDisplayName())));
for (const VideoBackend* backend : g_available_video_backends)
{
choice_backend->AppendString(wxGetTranslation(StrToWxStr(backend->GetDisplayName())));
}
choice_backend->SetStringSelection(wxGetTranslation(StrToWxStr(g_video_backend->GetDisplayName())));
choice_backend->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &VideoConfigDiag::Event_Backend, this);
@ -259,11 +258,10 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
{
wxChoice* const choice_adapter = CreateChoice(page_general, vconfig.iAdapter, wxGetTranslation(adapter_desc));
std::vector<std::string>::const_iterator
it = vconfig.backend_info.Adapters.begin(),
itend = vconfig.backend_info.Adapters.end();
for (; it != itend; ++it)
choice_adapter->AppendString(StrToWxStr(*it));
for (const std::string& adapter : vconfig.backend_info.Adapters)
{
choice_adapter->AppendString(StrToWxStr(adapter));
}
choice_adapter->Select(vconfig.iAdapter);
@ -381,11 +379,10 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
text_aamode = new wxStaticText(page_enh, -1, _("Anti-Aliasing:"));
choice_aamode = CreateChoice(page_enh, vconfig.iMultisampleMode, wxGetTranslation(aa_desc));
std::vector<std::string>::const_iterator
it = vconfig.backend_info.AAModes.begin(),
itend = vconfig.backend_info.AAModes.end();
for (; it != itend; ++it)
choice_aamode->AppendString(wxGetTranslation(StrToWxStr(*it)));
for (const std::string& mode : vconfig.backend_info.AAModes)
{
choice_aamode->AppendString(wxGetTranslation(StrToWxStr(mode)));
}
choice_aamode->Select(vconfig.iMultisampleMode);
szr_enh->Add(text_aamode, 1, wxALIGN_CENTER_VERTICAL, 0);
@ -406,11 +403,10 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
RegisterControl(choice_ppshader, wxGetTranslation(ppshader_desc));
choice_ppshader->AppendString(_("(off)"));
std::vector<std::string>::const_iterator
it = vconfig.backend_info.PPShaders.begin(),
itend = vconfig.backend_info.PPShaders.end();
for (; it != itend; ++it)
choice_ppshader->AppendString(StrToWxStr(*it));
for (const std::string& shader : vconfig.backend_info.PPShaders)
{
choice_ppshader->AppendString(StrToWxStr(shader));
}
if (vconfig.sPostProcessingShader.empty())
choice_ppshader->Select(0);