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

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

Details

Summary

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

Repository
R241 KIO
Branch
ahmad/foreach-kpac (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 17949
Build 17967: arc lint + arc unit
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.

src/kpac/script.cpp
157

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]

162

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
src/kpac/script.cpp
157

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

Fixing.

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.