D21515: Make it compile without foreach

Elvis Angelaccio noreply at phabricator.kde.org
Sat Jun 1 10:33:57 BST 2019


elvisangelaccio requested changes to this revision.
elvisangelaccio added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> CMakeLists.txt:89
>  add_definitions(-DTRANSLATION_DOMAIN="ark")
> +if (${KF5Config_VERSION} STRGREATER "5.56.0")
> +        add_definitions(-DQT_NO_FOREACH)

Is 5.56 the first KF5 release that builds without foreach?

If yes, can you add a comment explaining the reason for this check?

> deletetest.cpp:59
>      // Repeat the same test case for each format and for each plugin supporting the format.
> -    foreach (const QString &format, TestHelper::testFormats()) {
> +    const QStringList lst = TestHelper::testFormats();
> +    for (const QString &format : lst) {

Please call this variable `formats`

> extracttest.cpp:485
>      // Repeat the same test case for each format and for each plugin supporting the format.
> -    foreach (const QString &format, TestHelper::testFormats()) {
> +    const QStringList lst = TestHelper::testFormats();
> +    for (const QString &format : lst) {

Please call this variable `formats`

> abstractaddtest.cpp:51
>      // Repeat the same test case for each format and for each plugin supporting the format.
> -    foreach (const QString &format, TestHelper::testFormats()) {
> +    const QStringList lst = TestHelper::testFormats();
> +    for (const QString &format : lst) {

Please call this variable `formats`

> archiveentry.cpp:178
>  
> -    foreach (auto entry, entries()) {
> +    const auto lstEntries = entries();
> +    for (auto entry : lstEntries) {

Please call this variable `archiveEntries`

> cliproperties.cpp:78
>      QStringList args;
> -    foreach (const QString &s, substituteCommentSwitch(commentfile)) {
> +    const QStringList lst = substituteCommentSwitch(commentfile);
> +    for (const QString &s : lst) {

Please call this variable `commentSwitches`

> pluginmanager.cpp:127
>      QMimeDatabase db;
> -    foreach (Plugin *plugin, availablePlugins()) {
> -        foreach (const auto& mimeType, plugin->metaData().mimeTypes()) {
> +    const auto lstPlugins = availablePlugins();
> +    for (Plugin *plugin : lstPlugins) {

Please call this variable `plugins`

REPOSITORY
  R36 Ark

REVISION DETAIL
  https://phabricator.kde.org/D21515

To: mlaurent, elvisangelaccio
Cc: kde-utils-devel, #ark, tctara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-utils-devel/attachments/20190601/0b5610d0/attachment-0001.html>


More information about the Kde-utils-devel mailing list