#include <string>
#include <map>
#include <sys/types.h>
-#include <regex.h>
#include <boost/shared_ptr.hpp>
#include "pdns/namespaces.hh"
-
-/** very small regex wrapper */
-class Regex
-{
-public:
- /** constructor that accepts the expression to regex */
- Regex(const string &expr)
- {
- if(regcomp(&d_preg, expr.c_str(), REG_ICASE|REG_NOSUB|REG_EXTENDED))
- throw AhuException("Regular expression did not compile");
- }
- ~Regex()
- {
- regfree(&d_preg);
- }
- /** call this to find out if 'line' matches your expression */
- bool match(const string &line)
- {
- return regexec(&d_preg,line.c_str(),0,0,0)==0;
- }
-
-private:
- regex_t d_preg;
-};
+#include "pdns/misc.hh"
/** The CoWrapper class wraps around a coprocess and restarts it if needed.
return true;
}
+Regex::Regex(const string &expr)
+{
+ if(regcomp(&d_preg, expr.c_str(), REG_ICASE|REG_NOSUB|REG_EXTENDED))
+ throw AhuException("Regular expression did not compile");
+}
#include <inttypes.h>
#include <cstring>
#include <cstdio>
+#include <regex.h>
#include <boost/algorithm/string.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/ordered_index.hpp>
return res;
}
+/** very small regex wrapper */
+class Regex
+{
+public:
+ /** constructor that accepts the expression to regex */
+ Regex(const string &expr);
+
+ ~Regex()
+ {
+ regfree(&d_preg);
+ }
+ /** call this to find out if 'line' matches your expression */
+ bool match(const string &line)
+ {
+ return regexec(&d_preg,line.c_str(),0,0,0)==0;
+ }
+
+private:
+ regex_t d_preg;
+};
+
#endif