All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 <string>
7 #include <boost/regex.hpp>
8 
9 /*
10  * Gaudi namespace declaration
11  */
12 namespace Gaudi
13 {
14  namespace Utils
15  {
16  // ========================================================================
25  namespace RegEx
26  {
32  template <typename T> bool matchOr(const std::string & test, const T & regexps)
33  {
34  //compares the string in test, to the regexps in a container
35  for (typename T::const_iterator i = regexps.begin();
36  i != regexps.end(); ++i)
37  {
38  const boost::regex pattern(*i);
39  if (boost::regex_match(test, pattern)) return true;
40  }
41  return false;
42  }
43 
49  template <typename T> bool matchAnd(const std::string & test, const T & regexps)
50  {
51  //compares the string in test, to the regexps in a container
52  for (typename T::const_iterator i = regexps.begin();
53  i != regexps.end(); ++i)
54  {
55  const boost::regex pattern(*i);
56  if (!boost::regex_match(test, pattern)) return false;
57  }
58  return true;
59  }
60  }
61  }
62 }
63 #endif
bool matchOr(const std::string &test, const T &regexps)
return true if the string is in any of the regex's
Definition: RegEx.h:32
bool matchAnd(const std::string &test, const T &regexps)
return true if the string is in all of the regex's
Definition: RegEx.h:49
This is a number of static methods for bootstrapping the Gaudi framework.
Definition: Bootstrap.h:14
list i
Definition: ana.py:128