ircproxy The Ultimate Cyborg |
#include <Matcher.h>
Definition at line 167 of file Matcher.h.
Public Member Functions | |
Matcher_regexp (int param, std::string const &arg, bool single_param) | |
Construct a Matcher_regexp instance that matches parameter param (and on if single_param is false) against pattern arg. | |
~Matcher_regexp () | |
Destructor. | |
virtual void | print_type_on (std::ostream &os) const |
For debugging purposes. Write the class name to os. | |
virtual void | print_on (std::ostream &os) const |
For debugging purposes. Write the compiled pattern to os. | |
virtual int | sort_value (void) |
Implementation of pure virtual function Matcher::sort_value(). | |
Protected Member Functions | |
virtual bool | match_impl (ServerSession const &server_session, char const *start, size_t len) |
Match implementation interface filled in by derived classes. | |
Private Attributes | |
regex_t | M_regex |
Compiled regular expression. |
Matcher_regexp::Matcher_regexp | ( | int | param, | |
std::string const & | arg, | |||
bool | single_param | |||
) | [inline] |
Construct a Matcher_regexp instance that matches parameter param (and on if single_param is false) against pattern arg.
Definition at line 173 of file Matcher.h.
References ASSERT, and M_regex.
00173 : 00174 Matcher(param, single_param) 00175 { 00176 #if defined(CWDEBUG) || defined(DEBUG) 00177 int regcomp_error = 00178 #endif 00179 regcomp(&M_regex, arg.c_str(), REG_ICASE | REG_NOSUB); 00180 ASSERT(regcomp_error == 0); } //! Destructor.
Matcher_regexp::~Matcher_regexp | ( | ) | [inline] |
virtual void Matcher_regexp::print_type_on | ( | std::ostream & | os | ) | const [inline, virtual] |
virtual void Matcher_regexp::print_on | ( | std::ostream & | os | ) | const [inline, virtual] |
bool Matcher_regexp::match_impl | ( | ServerSession const & | server_session, | |
char const * | start, | |||
size_t | len | |||
) | [protected, virtual] |
Match implementation interface filled in by derived classes.
Implements Matcher.
Definition at line 89 of file Matcher.cc.
References M_regex.
00090 { 00091 char c = start[len]; 00092 const_cast<char*>(start)[len] = '\0'; 00093 bool success = regexec(&M_regex, start, 0, NULL, 0) == 0; 00094 const_cast<char*>(start)[len] = c; 00095 return success; 00096 }
virtual int Matcher_regexp::sort_value | ( | void | ) | [inline, virtual] |
Implementation of pure virtual function Matcher::sort_value().
Implements Matcher.
Definition at line 196 of file Matcher.h.
regex_t Matcher_regexp::M_regex [private] |
Compiled regular expression.
Definition at line 169 of file Matcher.h.
Referenced by match_impl(), Matcher_regexp(), and ~Matcher_regexp().
Copyright © 2005-2007 Carlo Wood. All rights reserved. |
---|