D9168: Migrate some QRegExps to QRegularExpression

Milian Wolff noreply at phabricator.kde.org
Tue Dec 5 13:19:03 UTC 2017


mwolff accepted this revision.
mwolff added inline comments.
This revision is now accepted and ready to land.

INLINE COMMENTS

> katedocument.cpp:4475
>      // found vars, if any
>      QString s;
>  

future: this could be a ref, quite probably, and capturedRef could be used below

> katedocument.cpp:4517
>  
>      QStringList vvl; // view variable names
>      vvl << QStringLiteral("dynamic-word-wrap") << QStringLiteral("dynamic-word-wrap-indicators")

future: someone should make this a static const array and use an initializer list

> katemodemanager.cpp:165
>          QString varLine = type->varLine;
> -        if (QRegExp(QLatin1String("kate:(.*)")).indexIn(varLine) < 0) {
> +        if (varLine.indexOf(QStringLiteral("kate:")) < 0) {
>              varLine.prepend(QLatin1String("kate: "));

even better: `!varLine.contains(QLatin1String("kate:"))`, or even `startsWith`? though the old code did a `contains` check

REPOSITORY
  R39 KTextEditor

BRANCH
  QRegExpCleanup (branched from master)

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

To: dhaumann, cullmann, kfunk, mwolff
Cc: #frameworks, kevinapavew, ngraham, demsking, cullmann, sars, dhaumann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20171205/d18ec795/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list