CmdExport: Simplified looping with 'auto'
This commit is contained in:
@@ -79,18 +79,19 @@ int CmdExport::execute (std::string& output)
|
|||||||
output += "[\n";
|
output += "[\n";
|
||||||
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (auto task = filtered.begin (); task != filtered.end (); ++task)
|
for (auto& task : filtered)
|
||||||
{
|
{
|
||||||
if (task != filtered.begin ())
|
if (counter)
|
||||||
{
|
{
|
||||||
if (json_array)
|
if (json_array)
|
||||||
output += ",";
|
output += ",";
|
||||||
output += "\n";
|
output += "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
output += task->composeJSON (true);
|
output += task.composeJSON (true);
|
||||||
|
|
||||||
if (limit && ++counter >= limit)
|
++counter;
|
||||||
|
if (limit && counter >= limit)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user