9 #include "includes/kratos_export_api.h"
10 #include "includes/model_part.h"
52 static std::pair<std::string,std::regex>
Integer();
133 using MatchType = std::map<std::string,std::vector<std::string>>;
202 template <
class TOutputIterator>
203 void Glob(TOutputIterator it)
const;
230 std::string mPattern;
235 std::string mRegexString;
244 static std::string FormatRegexLiteral(
const std::string& rLiteral);
285 using PlaceholderPattern::operator=;
303 std::string
Apply(
const ModelPart& rModelPart)
const;
360 using ModelPartPattern::operator=;
381 #include "wrapp/utils/impl/PatternUtility_impl.hpp"
A class for working with formatted strings related to Checkpoint.
Definition: PatternUtility.hpp:337
KRATOS_CLASS_POINTER_DEFINITION(CheckpointPattern)
CheckpointPattern(CheckpointPattern &&rOther)=default
CheckpointPattern(const CheckpointPattern &rOther)=default
CheckpointPattern()=default
static PlaceholderMap GetPlaceholderMap()
CheckpointPattern(const std::string &rPattern)
virtual void PopulatePlaceholderMap(PlaceholderMap &rMap, const ModelPart &rModelPart) const override
Populate a key-value map of registered placeholders from a ModelPart.
A class for working with formatted strings related to ModelParts.
Definition: PatternUtility.hpp:262
KRATOS_CLASS_POINTER_DEFINITION(ModelPartPattern)
ModelPartPattern(const std::string &rPattern, const PlaceholderMap &rPlaceholderMap)
Forwarding constructor for derived classes.
ModelPartPattern(const std::string &rPattern)
virtual void PopulatePlaceholderMap(PlaceholderMap &rMap, const ModelPart &rModelPart) const
Populate a key-value map of registered placeholders from a ModelPart.
ModelPartPattern()=default
ModelPartPattern(ModelPartPattern &&rOther)=default
static PlaceholderMap GetPlaceholderMap()
ModelPartPattern(const ModelPartPattern &rOther)=default
std::string Apply(const ModelPart &rModelPart) const
Substitute values from the specified ModelPart in the stored pattern.
A class for interfacing placeholders and regular expressions.
Definition: PatternUtility.hpp:124
PlaceholderPattern(const PlaceholderPattern &rOther)=default
Ref< const std::string > GetPatternString() const
Get the pattern with placeholders.
KRATOS_CLASS_POINTER_DEFINITION(PlaceholderPattern)
Ref< const std::string > GetRegexString() const
Get the string representation of the regex.
PlaceholderPattern & operator=(PlaceholderPattern &&rOther)=default
std::string Apply(Ref< const PlaceholderMap > rPlaceholderValueMap) const
Substitute values in the stored pattern.
std::map< std::string, std::vector< std::string > > MatchType
Definition: PatternUtility.hpp:133
virtual ~PlaceholderPattern()=default
PlaceholderPattern()=default
PlaceholderPattern & operator=(const PlaceholderPattern &rOther)=default
bool IsConst() const
Return true if the input pattern contains no placeholders.
std::filesystem::path PathType
Definition: PatternUtility.hpp:135
PlaceholderPattern(PlaceholderPattern &&rOther)=default
std::map< std::string, std::optional< std::vector< std::size_t > >> PlaceholderGroupMap
Definition: PatternUtility.hpp:131
MatchType Match(Ref< const std::string > rString) const
Find all placeholders' values in the input string.
bool IsAMatch(Ref< const std::string > rString) const
Check whether a string satisfies the pattern.
Ref< const std::regex > GetRegex() const
Get the regex for the input pattern.
std::map< std::string, std::string > PlaceholderMap
Definition: PatternUtility.hpp:129
PlaceholderPattern(Ref< const std::string > rPattern, Ref< const PlaceholderMap > rPlaceholderMap)
Construct from a placeholder pattern and its associated map.
void Glob(TOutputIterator it) const
Collect all file/directory paths that match the pattern.
PlaceholderMap GetPlaceholderMap() const
Get a map of all placeholders and their associated regex representations.
Static-only utility class for common regexes.
Definition: PatternUtility.hpp:36
static std::pair< std::string, std::regex > UnsignedInteger()
Get a string-regex pair representing an unsigned integer.
static std::pair< std::string, std::regex > Integer()
Get a string-regex pair representing an integer.
static std::pair< std::string, std::regex > FloatingPoint()
Get a string-regex pair representing an integer.
Definition: AddIOToPython.hpp:12
T & Ref
Definition: common.hpp:9