Gaudi Framework, version v21r8

Home   Generated: 17 Mar 2010

RegEx.h

Go to the documentation of this file.
00001 #ifndef GAUDIUTILS_REGEX_H
00002 #define GAUDIUTILS_REGEX_H
00003 // ============================================================================
00004 // Include files
00005 // ============================================================================
00006 #include <string>
00007 #include <boost/regex.hpp>
00008 
00009 /*
00010  *  Gaudi namespace declaration
00011  */
00012 namespace Gaudi
00013 {
00014   namespace  Utils
00015   {
00016     // ========================================================================
00025     namespace RegEx
00026     {
00032       template <typename T> bool matchOr(const std::string & test, const T & regexps)
00033       {
00034         //compares the string in test, to the regexps in a container
00035         for (typename T::const_iterator i = regexps.begin();
00036              i != regexps.end(); ++i)
00037         {
00038           const boost::regex pattern(*i);
00039           if (boost::regex_match(test, pattern)) return true;
00040         }
00041         return false;
00042       }
00043 
00049       template <typename T> bool matchAnd(const std::string & test, const T & regexps)
00050       {
00051         //compares the string in test, to the regexps in a container
00052         for (typename T::const_iterator i = regexps.begin();
00053              i != regexps.end(); ++i)
00054         {
00055           const boost::regex pattern(*i);
00056           if (!boost::regex_match(test, pattern)) return false;
00057         }
00058         return true;
00059       }
00060     }
00061   }
00062 }
00063 #endif

Generated at Wed Mar 17 18:06:51 2010 for Gaudi Framework, version v21r8 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004