RegexPattern.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2019 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef SQUID_SRC_BASE_REGEXPATTERN_H
10 #define SQUID_SRC_BASE_REGEXPATTERN_H
11 
12 #include "compat/GnuRegex.h"
13 #include "mem/forward.h"
14 
20 {
22 
23 public:
24  RegexPattern() = delete;
25  RegexPattern(int aFlags, const char *aPattern);
26  ~RegexPattern();
27 
28  // regex type varies by library, usually not safe to copy
29  RegexPattern(const RegexPattern &) = delete;
30  RegexPattern &operator =(const RegexPattern &) = delete;
31 
34 
35  const char * c_str() const {return pattern;}
36  bool match(const char *str) const {return regexec(&regex,str,0,NULL,0)==0;}
37 
38 public:
39  int flags;
41 
42 private:
43  char *pattern;
44 };
45 
46 #endif /* SQUID_SRC_BASE_REGEXPATTERN_H */
47 
char * pattern
Definition: RegexPattern.h:43
bool match(const char *str) const
Definition: RegexPattern.h:36
RegexPattern()=delete
regex_t regex
Definition: RegexPattern.h:40
RegexPattern & operator=(const RegexPattern &)=delete
const char * c_str() const
Definition: RegexPattern.h:35
int regexec(regex_t *preg, const char *string, size_t nmatch, pmatch, int eflags) const
Definition: GnuRegex.c:4191
MEMPROXY_CLASS(RegexPattern)
#define NULL
Definition: types.h:166

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors