Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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  namespace Utils {
14  // ========================================================================
23  namespace RegEx {
24  class matchList {
26 
27  public:
28  template <typename C>
29  matchList( const C& c ) {
30  m_regs.reserve( c.size() );
32  []( typename C::const_reference i ) { return boost::regex{i}; } );
33  }
34 
35  bool Or( const std::string& test ) const {
36  return std::any_of( std::begin( m_regs ), std::end( m_regs ),
37  [&]( const boost::regex& r ) { return boost::regex_match( test, r ); } );
38  }
39  bool And( const std::string& test ) const {
40  return std::all_of( std::begin( m_regs ), std::end( m_regs ),
41  [&]( const boost::regex& r ) { return boost::regex_match( test, r ); } );
42  }
43  };
44 
53  template <typename T>
54  bool matchOr( const std::string& test, const T& regexps ) {
55  // compares the string in test, to the regexps in a container
56  //
57  return std::any_of( std::begin( regexps ), std::end( regexps ), [&]( typename T::const_reference i ) {
58  return boost::regex_match( test, boost::regex{i} );
59  } );
60  }
61 
70  template <typename T>
71  bool matchAnd( const std::string& test, const T& regexps ) {
72  // compares the string in test, to the regexps in a container
73  //
74  return std::all_of( std::begin( regexps ), std::end( regexps ), [&]( typename T::const_reference i ) {
75  return boost::regex_match( test, boost::regex{i} );
76  } );
77  }
78  } // namespace RegEx
79  } // namespace Utils
80 } // namespace Gaudi
81 #endif
bool Or(const std::string &test) const
Definition: RegEx.h:35
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:54
T end(T...args)
STL class.
bool And(const std::string &test) const
Definition: RegEx.h:39
T begin(T...args)
T back_inserter(T...args)
std::vector< boost::regex > m_regs
Definition: RegEx.h:25
T any_of(T...args)
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:71
T transform(T...args)
Helper functions to set/get the application return code.
Definition: __init__.py:1
T reserve(T...args)