Loading...
Searching...
No Matches
Foam::stringListOps Namespace Reference

Various utility functions to work on lists of strings. More...

Classes

struct  foundOp
 Functor to determine if a string 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.
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, using a combination of allow and deny lists as per wordRes::filter.

Detailed Description

Various utility functions to work on lists of strings.

Source files

Function Documentation

◆ findMatching() [1/2]

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.

The filter predicate is a combination of allow and deny lists

Returns
List indices for matches

Referenced by surfaceFormatsCore::getSelectedPatches(), and triSurface::subsetMesh().

Here is the caller graph for this function:

◆ findMatching() [2/2]

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, using a combination of allow and deny lists as per wordRes::filter.

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)
* 
Returns
identity list when allow/deny are both empty.

References wordRes::null().

Here is the call graph for this function: