From d91a5abba1d66948cc43cc7a6c80827ede061bc8 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 30 Jan 2014 19:51:21 -0500 Subject: Light cleanup to a little bit of InputCommon. Replaces much of the iterators that litter this section of the codebase. Also clean up a little bit of the comments that describe the interface classes. --- Source/Core/InputCommon/InputConfig.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'Source/Core/InputCommon/InputConfig.cpp') diff --git a/Source/Core/InputCommon/InputConfig.cpp b/Source/Core/InputCommon/InputConfig.cpp index d627d047ad..41f18c8403 100644 --- a/Source/Core/InputCommon/InputConfig.cpp +++ b/Source/Core/InputCommon/InputConfig.cpp @@ -10,10 +10,8 @@ InputPlugin::~InputPlugin() { // delete pads - std::vector::const_iterator i = controllers.begin(), - e = controllers.end(); - for ( ; i != e; ++i ) - delete *i; + for (ControllerEmu* pad : controllers) + delete pad; } bool InputPlugin::LoadConfig(bool isGC) @@ -58,25 +56,26 @@ bool InputPlugin::LoadConfig(bool isGC) if (inifile.Load(File::GetUserPath(D_CONFIG_IDX) + ini_name + ".ini")) { - std::vector< ControllerEmu* >::const_iterator - i = controllers.begin(), - e = controllers.end(); - for (int n = 0; i!=e; ++i, ++n) + int n = 0; + for (ControllerEmu* pad : controllers) { - // load settings from ini + // Load settings from ini if (useProfile[n]) { IniFile profile_ini; profile_ini.Load(File::GetUserPath(D_CONFIG_IDX) + path + profile[n] + ".ini"); - (*i)->LoadConfig(profile_ini.GetOrCreateSection("Profile")); + pad->LoadConfig(profile_ini.GetOrCreateSection("Profile")); } else { - (*i)->LoadConfig(inifile.GetOrCreateSection((*i)->GetName().c_str())); + pad->LoadConfig(inifile.GetOrCreateSection(pad->GetName().c_str())); } - // update refs - (*i)->UpdateReferences(g_controller_interface); + // Update refs + pad->UpdateReferences(g_controller_interface); + + // Next profile + n++; } return true; } @@ -95,10 +94,8 @@ void InputPlugin::SaveConfig() IniFile inifile; inifile.Load(ini_filename); - std::vector< ControllerEmu* >::const_iterator i = controllers.begin(), - e = controllers.end(); - for ( ; i!=e; ++i ) - (*i)->SaveConfig(inifile.GetOrCreateSection((*i)->GetName().c_str())); + for (ControllerEmu* pad : controllers) + pad->SaveConfig(inifile.GetOrCreateSection(pad->GetName().c_str())); inifile.Save(ini_filename); } -- cgit v1.2.3