MarlinMT  0.1.0
marlinmt::book::ConditionBuilder Class Reference

helper to create a Condition. More...

#include <Condition.h>

Public Member Functions

 operator Condition () const
 implicit cast to Condition. More...
 
Condition condition () const
 construct new Condition. More...
 
ConditionBuildersetName (const std::string_view &name)
 only accept when key.name is perfect match to name. More...
 
ConditionBuildersetName (const std::basic_regex< char > &rgx)
 only accept when key.name includes a match. More...
 
ConditionBuildersetPath (const std::string_view &path)
 only accept when key.path is perfect match to path. More...
 
ConditionBuildersetPath (const std::basic_regex< char > &rgx)
 only accept when key.path includes a match. More...
 
ConditionBuildersetType (const std::type_index &type)
 only accept when Entry type matches. More...
 
template<typename T >
ConditionBuildersetType ()
 only accept when entry type matches. More...
 

Private Attributes

std::optional< std::string > _name {}
 stores perfect match for name, when setted. More...
 
std::basic_regex< char > _rgxName {".*", std::regex::optimize}
 stores name regex. Default matches every string. More...
 
std::optional< std::string > _path {}
 stores perfect match for path, when setted. More...
 
std::basic_regex< char > _rgxPath {".*", std::regex::optimize}
 stores path regex. Default matches every string. More...
 
std::optional< std::type_index > _type {}
 stores type index when setted. More...
 

Detailed Description

helper to create a Condition.

Definition at line 92 of file Condition.h.

Member Function Documentation

◆ condition()

Condition marlinmt::book::ConditionBuilder::condition ( ) const

◆ operator Condition()

marlinmt::book::ConditionBuilder::operator Condition ( ) const

implicit cast to Condition.

Definition at line 43 of file Condition.cc.

◆ setName() [1/2]

ConditionBuilder & marlinmt::book::ConditionBuilder::setName ( const std::string_view &  name)

only accept when key.name is perfect match to name.

Parameters
namestring which must perfect match key.name to accept key.
Note
when this is set, regex for the key.name will be ignored.

Definition at line 84 of file Condition.cc.

◆ setName() [2/2]

ConditionBuilder & marlinmt::book::ConditionBuilder::setName ( const std::basic_regex< char > &  rgx)

only accept when key.name includes a match.

Parameters
rgxregular expression.
Note
only used when no prefect match for name is set.
See also
ConditionBuilder::setName(const std::string_view &name)

Definition at line 92 of file Condition.cc.

◆ setPath() [1/2]

ConditionBuilder & marlinmt::book::ConditionBuilder::setPath ( const std::string_view &  path)

only accept when key.path is perfect match to path.

Parameters
pathstring which must perfect match key.path to accept key.
Note
when this is set, regex for key.path will be ignored.

Definition at line 100 of file Condition.cc.

◆ setPath() [2/2]

ConditionBuilder & marlinmt::book::ConditionBuilder::setPath ( const std::basic_regex< char > &  rgx)

only accept when key.path includes a match.

Parameters
rgxregular expression.
Note
only used when no perfect match for path is set.
See also
ConditionBuilder::setPath(const std::string_view &name)

Definition at line 108 of file Condition.cc.

◆ setType() [1/2]

ConditionBuilder & marlinmt::book::ConditionBuilder::setType ( const std::type_index &  type)

only accept when Entry type matches.

Parameters
typetype_index of type to match.

Definition at line 115 of file Condition.cc.

References marlinmt::book::_type.

◆ setType() [2/2]

template<typename T >
ConditionBuilder& marlinmt::book::ConditionBuilder::setType ( )
inline

only accept when entry type matches.

Template Parameters
Ttype to match.

Definition at line 141 of file Condition.h.

Member Data Documentation

◆ _name

std::optional< std::string > marlinmt::book::ConditionBuilder::_name {}
private

stores perfect match for name, when setted.

Definition at line 147 of file Condition.h.

◆ _path

std::optional< std::string > marlinmt::book::ConditionBuilder::_path {}
private

stores perfect match for path, when setted.

Definition at line 151 of file Condition.h.

◆ _rgxName

std::basic_regex< char > marlinmt::book::ConditionBuilder::_rgxName {".*", std::regex::optimize}
private

stores name regex. Default matches every string.

Definition at line 149 of file Condition.h.

◆ _rgxPath

std::basic_regex< char > marlinmt::book::ConditionBuilder::_rgxPath {".*", std::regex::optimize}
private

stores path regex. Default matches every string.

Definition at line 153 of file Condition.h.

◆ _type

std::optional< std::type_index > marlinmt::book::ConditionBuilder::_type {}
private

stores type index when setted.

Definition at line 155 of file Condition.h.


The documentation for this class was generated from the following files: