Foam::stringListOps Namespace Reference

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...
 

Detailed Description

Various utility functions to work on lists of strings.

Source files

Function Documentation

◆ findMatching() [1/2]

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 ensightMesh::correct(), surfaceFormatsCore::getSelectedPatches(), sampledMeshedSurface::sampledMeshedSurface(), and triSurface::subsetMesh().

Here is the caller graph for this function:

◆ findMatching() [2/2]

labelList 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)
Returns
List indices for matches