PathMatcher : Add in and containing - #1550
Conversation
These provide PathMatcher with equivalent behaviour to Gaffer's `in` and `containing` set expression operators. This implementation of `containing()` is based on `PathMatcher::intersection()`'s existing `find()`-based approach, rather than Gaffer::SetExpressionAlgo's `.match() & ( PathMatcher::ExactMatch | PathMatcher::DescendantMatch )`.
johnhaddon
left a comment
There was a problem hiding this comment.
LGTM.
Main quandary is what to name PathMatcher::in() as in is reserved in Python. For now, I've bound it to in_() as a placeholder for discussion.
If we think in is definitely the best name, then binding as in_ would be the usual approach.
I still like in and containing in set expressions - they seem reasonably descriptive without being too long, and they're not overly technical. chrome in robot and buildings containing wood read pretty well to me. Matching them so there's continuity between the C++ API and the expression language has its benefits.
pathsIn()? commonDescendants() ? somethingBetterThatIHaventYetThoughtOf()
The only benefit of pathsIn() seems to be the underscore avoidance - it doesn't add much otherwise. commonDescendants() sounds odd, since it returns paths that aren't necessarily common to both matchers.
Other possibilities might be descendantsOf( paths ) and ancestorsOf( paths ). They're reasonably descriptive, but would still need documenting to say that we include exact matches in descendants and ancestors. And chrome descendantsOf robot and buildings ancestorsOf wood don't seem as good as what we have already.
Unless anyone else feels strongly, I think I'm inclined to stick with in_.
|
|
|
We don't seem to have methods with trailing |
These provide PathMatcher with equivalent behaviour to Gaffer's
inandcontainingset expression operators.This implementation of
containing()is based onPathMatcher::intersection()'s existingfind()-based approach, rather than Gaffer::SetExpressionAlgo's.match() & ( PathMatcher::ExactMatch | PathMatcher::DescendantMatch ).Main quandary is what to name
PathMatcher::in()asinis reserved in Python. For now, I've bound it toin_()as a placeholder for discussion.pathsIn()?commonDescendants()?somethingBetterThatIHaventYetThoughtOf()?