44 #ifndef Foam_stringListOps_H 45 #define Foam_stringListOps_H 57 template<
class UnaryMatchPredicate,
class StringType>
60 const UnaryMatchPredicate& matcher,
61 const UList<StringType>&
input,
74 template<
class UnaryMatchPredicate,
class StringType>
77 const UnaryMatchPredicate& matcher,
78 const UList<StringType>&
input,
85 template<
class StringType>
89 const UList<StringType>&
input,
99 template<
class StringType>
102 const keyType& matcher,
103 const UList<StringType>&
input,
118 template<
class StringType>
121 const wordRe& matcher,
122 const UList<StringType>&
input,
132 template<
class StringType>
145 template<
class StringType>
166 template<
class UnaryMatchPredicate,
class StringListType>
169 const UnaryMatchPredicate& matcher,
170 const StringListType&
input,
177 template<
class StringListType>
181 const StringListType&
input,
191 template<
class StringListType>
194 const keyType& matcher,
195 const StringListType&
input,
209 template<
class StringListType>
212 const wordRe& matcher,
213 const StringListType&
input,
222 template<
class StringListType>
226 const StringListType&
input,
236 template<
class StringListType>
239 const UList<wordRe>& patterns,
252 template<
class UnaryMatchPredicate,
class StringListType>
255 const UnaryMatchPredicate& matcher,
262 template<
class StringListType>
266 StringListType&
input,
275 template<
class StringListType>
279 StringListType&
input,
293 template<
class StringListType>
296 const wordRe& matcher,
297 StringListType&
input,
306 template<
class StringListType>
310 StringListType&
input,
319 template<
class StringListType>
323 StringListType&
input,
335 namespace stringListOps
344 template<
class StringType>
354 bool operator()(
const std::string& text)
const 365 template<
class StringListType,
class AccessOp =
identityOp>
368 const StringListType&
input,
369 const wordRes::filter& pred,
370 AccessOp aop = identityOp()
390 template<
class StringListType,
class AccessOp =
identityOp>
393 const StringListType&
input,
416 template<
class StringType>
419 const char* disallowed,
428 template<
class StringType>
431 const std::string& disallowed,
440 template<
class StringListType>
443 const char* disallowed,
444 const StringListType&
input,
452 template<
class StringListType>
455 const std::string& disallowed,
456 const StringListType&
input,
464 template<
class StringListType>
467 const char* disallowed,
468 StringListType&
input,
476 template<
class StringListType>
479 const std::string& disallowed,
480 StringListType&
input,
StringListType subsetMatchingStrings(const UnaryMatchPredicate &matcher, const StringListType &input, const bool invert=false)
Extract elements of StringList when regular expression matches.
A class for handling keywords in dictionaries.
const UList< StringType > & values
labelList findMatchingStrings(const UnaryMatchPredicate &matcher, const UList< StringType > &input, const bool invert=false)
Extract list indices for all matches.
label firstMatchingString(const UnaryMatchPredicate &matcher, const UList< StringType > &input, const bool invert=false)
Find first list item that matches, -1 on failure.
bool operator()(const std::string &text) const
bool found(const T &val, label pos=0) const
Same as contains()
StringListType subsetStrings(const regExp &matcher, const StringListType &input, const bool invert=false)
Extract elements of StringList when regular expression matches.
Various functors for unary and binary operations. Can be used for parallel combine-reduce operations ...
regExpPosix regExp
Selection of preferred regular expression implementation.
static const wordRes & null()
Return a null wordRes - a reference to the NullObject.
static Istream & input(Istream &is, IntRange< T > &range)
labelList findMatching(const StringListType &input, const wordRes::filter &pred, AccessOp aop=identityOp())
Return ids for items with matching names.
bool isPattern() const noexcept
The keyType is treated as a pattern, not as literal string.
A List of wordRe with additional matching capabilities.
A functor that returns its argument unchanged (cf. C++20 std::identity) Should never be specialized...
void inplaceSubsetStrings(const regExp &matcher, StringListType &input, const bool invert=false)
Inplace extract elements of StringList when regular expression matches.
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
Wrapper around POSIX extended regular expressions with some additional prefix-handling. The prefix-handling is loosely oriented on PCRE regular expressions and provides a simple means of tuning the expressions.
Functor wrapper of a list of wordRe for matching.
List< label > labelList
A List of labels.
foundOp(const UList< StringType > &list)
labelList findStrings(const regExp &matcher, const UList< StringType > &input, const bool invert=false)
Return list indices for strings matching the regular expression.
void inplaceSubsetMatchingStrings(const UnaryMatchPredicate &matcher, StringListType &input, const bool invert=false)
Inplace extract elements of StringList when regular expression matches.