C++11: Cleaned up commands code with range-based for

This commit is contained in:
Paul Beckingham 2015-05-11 17:45:15 -04:00
parent bd3d58484a
commit 5a57dfd70d
42 changed files with 911 additions and 1065 deletions

View file

@ -118,13 +118,12 @@ int CmdCustom::execute (std::string& output)
std::vector <std::string> sortColumns;
// Add the break columns, if any.
std::vector <std::string>::iterator so;
for (so = sortOrder.begin (); so != sortOrder.end (); ++so)
for (auto& so : sortOrder)
{
std::string name;
bool ascending;
bool breakIndicator;
context.decomposeSortField (*so, name, ascending, breakIndicator);
context.decomposeSortField (so, name, ascending, breakIndicator);
if (breakIndicator)
view.addBreak (name);
@ -211,17 +210,15 @@ int CmdCustom::execute (std::string& output)
////////////////////////////////////////////////////////////////////////////////
void CmdCustom::validateReportColumns (std::vector <std::string>& columns)
{
std::vector <std::string>::iterator i;
for (i = columns.begin (); i != columns.end (); ++i)
legacyColumnMap (*i);
for (auto& col : columns)
legacyColumnMap (col);
}
////////////////////////////////////////////////////////////////////////////////
void CmdCustom::validateSortColumns (std::vector <std::string>& columns)
{
std::vector <std::string>::iterator i;
for (i = columns.begin (); i != columns.end (); ++i)
legacySortColumnMap (*i);
for (auto& col : columns)
legacySortColumnMap (col);
}
////////////////////////////////////////////////////////////////////////////////