#include <RegexPattern.h>

Collaboration diagram for RegexPattern:

Public Member Functions

 RegexPattern ()=delete
 RegexPattern (const SBuf &aPattern, int aFlags)
 ~RegexPattern ()
 RegexPattern (RegexPattern &&)=delete
bool caseSensitive () const
 whether the regex differentiates letter case More...
bool isDot () const
 whether this is an "any single character" regex (".") More...
bool match (const char *str) const
void print (std::ostream &os, const RegexPattern *previous=nullptr) const

Private Member Functions

 MEMPROXY_CLASS (RegexPattern)

Private Attributes

SBuf pattern
 a regular expression in the text form, suitable for regcomp(3) More...
const int flags
 bitmask of REG_* flags for regcomp(3) More...
regex_t regex
 a "compiled pattern buffer" filled by regcomp(3) for regexec(3) More...

Detailed Description

A regular expression, plain text and compiled representations

Definition at line 20 of file RegexPattern.h.

Constructor & Destructor Documentation

◆ RegexPattern() [1/3]

RegexPattern::RegexPattern ( )

◆ RegexPattern() [2/3]

RegexPattern::RegexPattern ( const SBuf aPattern,
int  aFlags 

Definition at line 18 of file RegexPattern.cc.

References SBuf::c_str(), debugs, Debug::Extra(), flags, Here, pattern, regcomp(), regerror(), regex, and ToSBuf().

◆ ~RegexPattern()

RegexPattern::~RegexPattern ( )

Definition at line 36 of file RegexPattern.cc.

References regex, and regfree().

◆ RegexPattern() [3/3]

RegexPattern::RegexPattern ( RegexPattern &&  )

Member Function Documentation

◆ caseSensitive()

bool RegexPattern::caseSensitive ( ) const

Definition at line 32 of file RegexPattern.h.

References flags, and REG_ICASE.

Referenced by print().

◆ isDot()

bool RegexPattern::isDot ( ) const

Definition at line 35 of file RegexPattern.h.

References SBuf::length(), and pattern.

◆ match()

bool RegexPattern::match ( const char *  str) const

Definition at line 37 of file RegexPattern.h.

References NULL, regex, and regexec().


RegexPattern::MEMPROXY_CLASS ( RegexPattern  )

◆ print()

void RegexPattern::print ( std::ostream &  os,
const RegexPattern previous = nullptr 
) const

Attempts to reproduce this regex (context-sensitive) configuration. If the previous regex is nil, may not report default flags. Otherwise, may not report same-as-previous flags (and prepends a space).

Definition at line 42 of file RegexPattern.cc.

References caseSensitive(), flags, and pattern.

Referenced by ACLRegexData::dump(), and operator<<().

Member Data Documentation

◆ flags

const int RegexPattern::flags

Definition at line 49 of file RegexPattern.h.

Referenced by RegexPattern(), caseSensitive(), and print().

◆ pattern

SBuf RegexPattern::pattern

Definition at line 46 of file RegexPattern.h.

Referenced by RegexPattern(), isDot(), and print().

◆ regex

regex_t RegexPattern::regex

Definition at line 52 of file RegexPattern.h.

Referenced by RegexPattern(), ~RegexPattern(), and match().

The documentation for this class was generated from the following files:






Web Site Translations