| The Gaudi Framework v28r2p1 (f1a77ff4)

- 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 <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 {
27 class matchList {
28 std::vector<boost::regex> m_regs;
29 public:
30 template <typename C> matchList(const C& c) {
31 m_regs.reserve(c.size());
32 std::transform( std::begin(c), std::end(c),
33 std::back_inserter(m_regs),
34 [](typename C::const_reference i) { return boost::regex{i}; } );
35 }
36
37 bool Or(const std::string& test) const {
38 return std::any_of( std::begin(m_regs), std::end(m_regs),
39 [&](const boost::regex& r) {
40 return boost::regex_match(test, r);
41 });
42 }
43 bool And(const std::string& test) const {
44 return std::all_of( std::begin(m_regs), std::end(m_regs),
45 [&](const boost::regex& r) {
46 return boost::regex_match(test, r);
47 });
48 }
49
50 };
51
60 template <typename T> bool matchOr(const std::string & test, const T & regexps)
61 {
62 //compares the string in test, to the regexps in a container
63 //
64 return std::any_of( std::begin(regexps), std::end(regexps),
65 [&](typename T::const_reference i) {
66 return boost::regex_match(test, boost::regex{i});
67 });
68 }
69
78 template <typename T> bool matchAnd(const std::string & test, const T & regexps)
79 {
80 //compares the string in test, to the regexps in a container
81 //
82 return std::all_of( std::begin(regexps), std::end(regexps),
83 [&](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:858
gaudirun.c
c
Definition: gaudirun.py:391
Gaudi::Utils::RegEx::matchList
Definition: RegEx.h:27
Gaudi::Utils::RegEx::matchList::Or
bool Or(const std::string &test) const
Definition: RegEx.h:37
Gaudi::Utils::RegEx::matchList::matchList
matchList(const C &c)
Definition: RegEx.h:30
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:60
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:43
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:28
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:78
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)