D11888: Handle adjacent special characters correctly

Michael Heidelbach noreply at phabricator.kde.org
Wed Apr 4 08:25:13 UTC 2018


michaelh added inline comments.

INLINE COMMENTS

> bruns wrote in advancedqueryparser.cpp:69
> > I don't understand. token is QString. Why not instead of switch (token.at(0).toLatin1())
> > 
> >   switch (token) {
> >   case '>'`: comparator = Term::Greater; break;
> >   case '>='`: comparator = Term::GreaterEqual; break;
> > 
> > 
> > What am I missing?
> 
> You can only `switch` on integral statements (ints, chars, ...). With C++11, you can do some `constexpr` hacks, but your code won't work as is.

> You can only switch on integral statements (ints, chars, ...).

Heh? That's surprising![1] Anyway, thanks for the lesson a keep this code as it is now.

[1]
Coming from javascript `switch` definitely is a "false friend". 
Can I become a beef steak?

REPOSITORY
  R293 Baloo

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

To: bruns, #baloo, michaelh
Cc: #frameworks, ashaposhnikov, michaelh, astippich, spoorun, ngraham, alexeymin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180404/49709454/attachment.html>


More information about the Kde-frameworks-devel mailing list