deal.II version GIT relicensing-2206-gaa53ff9447 2024-12-02 09:10:00+00:00
|
#include <deal.II/base/patterns.h>
Public Types | |
enum | OutputStyle { Machine , Text , LaTeX } |
Public Member Functions | |
Tuple (const std::vector< std::unique_ptr< PatternBase > > &patterns, const std::string &separator=":") | |
Tuple (const std::vector< std::unique_ptr< PatternBase > > &patterns, const char *separator) | |
template<class... PatternTypes> | |
Tuple (const std::string &separator, const PatternTypes &...patterns) | |
template<class... PatternTypes> | |
Tuple (const char *separator, const PatternTypes &...patterns) | |
template<typename... Patterns> | |
Tuple (const Patterns &...patterns) | |
Tuple (const Tuple &other) | |
virtual bool | match (const std::string &test_string) const override |
virtual std::string | description (const OutputStyle style=Machine) const override |
virtual std::unique_ptr< PatternBase > | clone () const override |
std::size_t | memory_consumption () const override |
const PatternBase & | get_pattern (const unsigned int i) const |
const std::string & | get_separator () const |
template<class... PatternTypes> | |
Tuple (const PatternTypes &...ps) | |
Static Public Member Functions | |
static std::unique_ptr< Tuple > | create (const std::string &description) |
Private Attributes | |
std::vector< std::unique_ptr< PatternBase > > | patterns |
const std::string | separator |
Static Private Attributes | |
static const char * | description_init = "[Tuple" |
This pattern matches colon-separated values of arbitrary types. Each type has to match a pattern given to the constructor.
An example usage is the following:
or, if you want to exploit ParameterHandler::add_parameter():
The constructor expects a vector of Patterns, and optionally a string specifying the separator to use when parsing the Tuple from a string.
The default separator is a colon, owing to the fact that a pair is in fact a tuple with two elements.
Definition at line 773 of file patterns.h.
|
inherited |
List of possible description output formats.
Capitalization chosen for similarity to ParameterHandler::OutputStyle.
Definition at line 100 of file patterns.h.
Patterns::Tuple::Tuple | ( | const std::vector< std::unique_ptr< PatternBase > > & | patterns, |
const std::string & | separator = ":" |
||
) |
Constructor. Use a vector of unique pointers to Patterns to construct the tuple.
patterns | The pattern each object of the Tuple should match |
separator | An optional string used to delimit each element Constructor. |
Definition at line 1071 of file patterns.cc.
Patterns::Tuple::Tuple | ( | const std::vector< std::unique_ptr< PatternBase > > & | patterns, |
const char * | separator | ||
) |
Constructor. Same as above, specialized for const char *. This is necessary to avoid compilers errors due to the variadic constructors provided below.
Definition at line 1086 of file patterns.cc.
Patterns::Tuple::Tuple | ( | const std::string & | separator, |
const PatternTypes &... | patterns | ||
) |
Constructor. Creates a Tuple from more than one class derived from PatternBase.
separator | What separator to use. |
patterns | The list of patterns to use |
Definition at line 1426 of file patterns.h.
Patterns::Tuple::Tuple | ( | const char * | separator, |
const PatternTypes &... | patterns | ||
) |
Constructor. This is needed to allow users to specify directly the separator without using ";".
Since we support a pure variadic templates version, without this specialization, the compiler will fail with cryptic errors.
Definition at line 1418 of file patterns.h.
Patterns::Tuple::Tuple | ( | const Patterns &... | patterns | ) |
Constructor. Same as above, using the default separator.
patterns | The list of patterns to use |
Patterns::Tuple::Tuple | ( | const Tuple & | other | ) |
Copy constructor.
Definition at line 1093 of file patterns.cc.
Patterns::Tuple::Tuple | ( | const PatternTypes &... | ps | ) |
Definition at line 1442 of file patterns.h.
|
overridevirtual |
Return true
if the string is a list of strings each of which matches the patterns given to the constructor.
Implements Patterns::PatternBase.
Definition at line 1104 of file patterns.cc.
|
overridevirtual |
Return a description of the pattern that valid strings are expected to match.
Implements Patterns::PatternBase.
Definition at line 1123 of file patterns.cc.
|
overridevirtual |
Return a copy of the present object, which is newly allocated on the heap. Ownership of that object is transferred to the caller of this function.
Implements Patterns::PatternBase.
Definition at line 1173 of file patterns.cc.
|
static |
Create a new object if the start of description matches description_init. Ownership of that object is transferred to the caller of this function.
Definition at line 1189 of file patterns.cc.
|
overridevirtual |
Determine an estimate for the memory consumption (in bytes) of this object.
Reimplemented from Patterns::PatternBase.
Definition at line 1180 of file patterns.cc.
const PatternBase & Patterns::Tuple::get_pattern | ( | const unsigned int | i | ) | const |
Return a reference to the i-th pattern in the tuple.
Definition at line 1237 of file patterns.cc.
const std::string & Patterns::Tuple::get_separator | ( | ) | const |
Return the separator of the tuple entries.
Definition at line 1245 of file patterns.cc.
|
private |
Copy of the patterns stored in the Tuple.
Definition at line 882 of file patterns.h.
|
private |
Separator between elements of the list.
Definition at line 887 of file patterns.h.
|
staticprivate |
Initial part of description.
Definition at line 892 of file patterns.h.