D26366: [Kuit] Port QRegExp to QRegularExpression, third pass

Ahmad Samir noreply at phabricator.kde.org
Fri Jan 3 14:04:53 GMT 2020


ahmadsamir added inline comments.

INLINE COMMENTS

> dfaure wrote in kuitmarkup.cpp:90
> Interesting idea, this simplifies the code.
> 
> However the name "wsRx" no longer matches what this regexp does.
> 
> Also, the old trimming is missing here, isn't it?
> I guess \s*:?\s* is needed, and \s*/?\s*
> 
> Can you look into adding unittests for this stuff? Although I'm not sure if that's possible.

Ah, yes, ws is white-space, I haven't figured it out except now :), I'll change it.

The code first trimmed the string, so any leading white space is gone; the original code didn't expect any white-space inside "@role:cue/format", because the code cut the string off right before the first occurrence of \s:

  context = context.mid(1, wsRx.indexIn(context) - 1);

so there can't be any white space in the context part. Also looking at the guide, https://api.kde.org/frameworks/ki18n/html/prg_guide.html#good_ctxt , that's how usage is demonstrated, e.g. "@info:whatsthis/plain".

I did look at the unit test, but i18nc() calls don't seem to fail on the context part, it just consumes it. I'll see if I can call parseUiMarker() directly and feed it some good and some bad strings.

REPOSITORY
  R249 KI18n

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

To: ahmadsamir, #frameworks, ilic, dfaure, mlaurent, aacid
Cc: kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200103/98af76f7/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list