| The Gaudi Framework v29r1 (5cd95fa2)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

RegEx.h
Go to the documentation of this file.
1 #ifndef GAUDIUTILS_REGEX_H
2 #define GAUDIUTILS_REGEX_H
3 // ============================================================================
4 // Include files
5 // ============================================================================
6 #include <boost/regex.hpp>
7 #include <string>
8
9 /*
10 * Gaudi namespace declaration
11 */
12 namespace Gaudi
13 {
14 namespace Utils
15 {
16 // ========================================================================
25 namespace RegEx
26 {
27 class matchList
28 {
29 std::vector<boost::regex> m_regs;
30
31 public:
32 template <typename C>
33 matchList( const C& c )
34 {
35 m_regs.reserve( c.size() );
36 std::transform( std::begin( c ), std::end( c ), std::back_inserter( m_regs ),
37 []( typename C::const_reference i ) { return boost::regex{i}; } );
38 }
39
40 bool Or( const std::string& test ) const
41 {
42 return std::any_of( std::begin( m_regs ), std::end( m_regs ),
43 [&]( const boost::regex& r ) { return boost::regex_match( test, r ); } );
44 }
45 bool And( const std::string& test ) const
46 {
47 return std::all_of( std::begin( m_regs ), std::end( m_regs ),
48 [&]( const boost::regex& r ) { return boost::regex_match( test, r ); } );
49 }
50 };
51
60 template <typename T>
61 bool matchOr( const std::string& test, const T& regexps )
62 {
63 // compares the string in test, to the regexps in a container
64 //
65 return std::any_of( std::begin( regexps ), std::end( regexps ), [&]( typename T::const_reference i ) {
66 return boost::regex_match( test, boost::regex{i} );
67 } );
68 }
69
78 template <typename T>
79 bool matchAnd( const std::string& test, const T& regexps )
80 {
81 // compares the string in test, to the regexps in a container
82 //
83 return std::all_of( std::begin( regexps ), std::end( regexps ), [&]( typename T::const_reference i ) {
84 return boost::regex_match( test, boost::regex{i} );
85 } );
86 }
87 }
88 }
89 }
90 #endif
GaudiTesting.BaseTest.regexps
regexps
Definition: BaseTest.py:932
gaudirun.c
c
Definition: gaudirun.py:407
Gaudi::Utils::RegEx::matchList
Definition: RegEx.h:27
Gaudi::Utils::RegEx::matchList::Or
bool Or(const std::string &test) const
Definition: RegEx.h:40
Gaudi::Utils::RegEx::matchList::matchList
matchList(const C &c)
Definition: RegEx.h:33
Gaudi::Utils::RegEx::matchOr
bool matchOr(const std::string &test, const T &regexps)
return true if the string is in any of the regex&#39;s
Definition: RegEx.h:61
std::end
T end(T...args)
std::string
STL class.
compareRootHistos.test
string test
Definition: compareRootHistos.py:15
Gaudi::Utils::RegEx::matchList::And
bool And(const std::string &test) const
Definition: RegEx.h:45
std::vector< boost::regex >
std::begin
T begin(T...args)
std::back_inserter
T back_inserter(T...args)
Gaudi::Utils::RegEx::matchList::m_regs
std::vector< boost::regex > m_regs
Definition: RegEx.h:29
std::any_of
T any_of(T...args)
Gaudi::Utils::RegEx::matchAnd
bool matchAnd(const std::string &test, const T &regexps)
return true if the string is in all of the regex&#39;s
Definition: RegEx.h:79
std::transform
T transform(T...args)
Gaudi
Helper functions to set/get the application return code.
Definition: __init__.py:1
std::vector::reserve
T reserve(T...args)