30inline Foam::label Foam::wordRes::first_match
32 const UList<wordRe>& selectors,
33 const std::string& text,
38 for (
const wordRe& select : selectors)
40 if (
select.match(text, literal))
56 const std::string& text,
60 for (
const wordRe& select : selectors)
62 if (select.match(text, literal))
74 const std::string& text
83 if (
select.match(text,
true))
92 &&
select.match(text,
false)
103template<
class StringType>
106 const wordRe& select,
107 const UList<StringType>& input,
116 const label len = input.
size();
121 for (label i = 0; i < len; ++i)
129 indices.resize(count);
135template<
class StringType>
148 const label len = input.
size();
153 for (label i = 0; i < len; ++i)
161 indices.resize(count);
182template<
class StringType>
225 return select_.empty();
231 return (allow_.empty() && deny_.empty());
249 else if (deny_.empty())
void resize(const label len)
Adjust allocated size of list.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
bool empty() const noexcept
True if List is empty (ie, size() is zero).
void size(const label n)
Older name for setAddressableSize.
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
compOption
Enumeration with compile options.
@ REGEX
Regular expression.
@ UNKNOWN
Unknown content (for return value).
static labelList matching(const wordRe &select, const UList< StringType > &input, const bool invert=false)
Determine the list indices for all matches.
bool operator()(const std::string &text) const
Identical to match(), for use as a predicate.
static wordRe::compOption matched(const UList< wordRe > &selectors, const std::string &text)
Smart match across entire list, returning the best match type.
static bool match(const UList< wordRe > &selectors, const std::string &text, bool literal=false)
Test for a match of any selectors against the text.
List< bool > select(const label n, const labelUList &locations)
Construct a selection list of bools (all false) with the given pre-size, subsequently add specified l...
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
List< label > labelList
A List of labels.
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
filter(const UList< wordRe > &allow, const UList< wordRe > &deny) noexcept
Construct with allow and deny matchers.
bool empty() const noexcept
No filtering defined.
bool operator()(const std::string &text) const
Apply filter against specified text.
bool empty() const noexcept
No selectors defined.
bool operator()(const std::string &text) const
Apply matcher predicate.
matcher(const UList< wordRe > &selectors) noexcept
Construct with select matcher(s).