Add operator |= for Query Terms
AbandonedPublic

Authored by meven on Fri, Aug 23, 8:31 AM.

Details

Reviewers
ivan
Summary

With it, we can now write :
query |= Type(types);
instead of :
query = query | Type(types);

Test Plan

Compiles

Diff Detail

Repository
R159 KActivities Statistics
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 15522
Build 15540: arc lint + arc unit
meven created this revision.Fri, Aug 23, 8:31 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptFri, Aug 23, 8:31 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
meven requested review of this revision.Fri, Aug 23, 8:31 AM
ivan requested changes to this revision.Fri, Aug 23, 9:07 AM

This is something I did have initally in kastats, it was killed because while this is tempting

query |= Type(types);

it ruins the idea of the chaning API because it can not be used like this:

query |= Type(types) | OtherTerm(...);

In order for this to work properly, we'd need to use expression templates which would make the library significanly more complex.

I don't think it is worth it.

This revision now requires changes to proceed.Fri, Aug 23, 9:07 AM
meven added a comment.Fri, Aug 23, 9:16 AM
In D23372#517378, @ivan wrote:

This is something I did have initally in kastats, it was killed because while this is tempting

query |= Type(types);

it ruins the idea of the chaning API because it can not be used like this:

query |= Type(types) | OtherTerm(...);

In order for this to work properly, we'd need to use expression templates which would make the library significanly more complex.

I see, I am not sure to want to go that way.

Chaining would still be possible simply with another form:
query = query | Type(types) | OtherTerm(...);

I don't think it is worth it.

I would be ok to abandon this, this was motived by :
https://phabricator.kde.org/D22144#inline-131974
Do you see a problem, or should we consider it as fine ?

ivan added a comment.Fri, Aug 23, 9:36 AM

You can also use set*/add* member functions for this so that David doesn't complain. As I said, pipes are mainly there for chaining - easy query creation API to simplify the alternative of set set set set set. But if you set a single field, I'd say set*/add* is a fine option.

meven abandoned this revision.Mon, Aug 26, 5:38 AM

Abandoned in favor of D23399