Various utility functions to work on lists of strings. More...
Classes | |
struct | foundOp |
Functor to determine if a string is exists in a list of strings. More... | |
Functions | |
template<class StringListType , class AccessOp = identityOp> | |
labelList | findMatching (const StringListType &input, const wordRes::filter &pred, AccessOp aop=identityOp()) |
Return ids for items with matching names. More... | |
template<class StringListType , class AccessOp = identityOp> | |
labelList | findMatching (const StringListType &input, const wordRes &allow, const wordRes &deny=wordRes::null(), AccessOp aop=identityOp()) |
Return ids for items with matching names. More... | |
Various utility functions to work on lists of strings.
labelList Foam::stringListOps::findMatching | ( | const StringListType & | input, |
const wordRes::filter & | pred, | ||
AccessOp | aop = identityOp() |
||
) |
Return ids for items with matching names.
The filter predicate is a combination of allow and deny lists
Referenced by ensightMesh::correct(), sampledMeshedSurface::sampledMeshedSurface(), and triSurface::subsetMesh().
labelList Foam::stringListOps::findMatching | ( | const StringListType & | input, |
const wordRes & | allow, | ||
const wordRes & | deny = wordRes::null() , |
||
AccessOp | aop = identityOp() |
||
) |
Return ids for items with matching names.
Uses a combination of allow and deny lists
An empty 'allow' accepts everything not in 'deny'. A literal 'allow' match has higher priority than any 'deny'. A regex 'allow' match has lower priority than any 'deny'.
Example (when applied to a list of words),
* input: ( abc apple test other val val1 val2 wall wall1 wall2 ) * allow: ( abc def "t.*" other val val1 "wall.*" ) * deny: ( "[ab].*" "t.*" other "val[0-9]" wall ) * * result: (abc other val val1 wall1 wall2) *