[src/kpac/*] replace deprecated foreach with range for

Authored by ahmadsamir on Oct 1 2019, 7:20 PM.



Change addresses() to make it return a const QList &, this way it can
be iterated over, with a range-for, without detaching.

Test Plan

make && ctest

Diff Detail

R241 KIO
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
ahmadsamir created this revision.Oct 1 2019, 7:20 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptOct 1 2019, 7:20 PM
ahmadsamir requested review of this revision.Oct 1 2019, 7:20 PM
dfaure requested changes to this revision.Oct 20 2019, 10:21 PM

sorry, missed this one. thanks for the ping.


Why not just change this one to return const & and then use it in all range-fors?

[note that returning a const ref is bad in public API, but this is an internal method so we can always change it again if needed]


it's just weird to have two methods that do the same thing, with a different name.

This revision now requires changes to proceed.Oct 20 2019, 10:21 PM
ahmadsamir edited the summary of this revision. (Show Details)

In private API we can have a method return a const &, as it can be
changed later without side-effects.

ahmadsamir added inline comments.Oct 21 2019, 3:42 AM

Because I didn't pay attention to public v.s. private API :)


dfaure accepted this revision.Oct 21 2019, 8:04 AM
This revision is now accepted and ready to land.Oct 21 2019, 8:04 AM
This revision was automatically updated to reflect the committed changes.