ircproxy The Ultimate Cyborg |
#include <Matcher.h>
Definition at line 110 of file Matcher.h.
Public Member Functions | |
Matcher_noarg (int param, match0_type mt, bool single_param) | |
Construct a Matcher_noarg object of type mt that will match against parameter param (and on, if single_param is false). | |
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 match type 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. | |
Protected Attributes | |
match0_type | M_mt |
The match type. |
Matcher_noarg::Matcher_noarg | ( | int | param, | |
match0_type | mt, | |||
bool | single_param | |||
) | [inline] |
Construct a Matcher_noarg object of type mt that will match against parameter param (and on, if single_param is false).
Definition at line 116 of file Matcher.h.
virtual void Matcher_noarg::print_type_on | ( | std::ostream & | os | ) | const [inline, virtual] |
virtual void Matcher_noarg::print_on | ( | std::ostream & | os | ) | const [inline, virtual] |
bool Matcher_noarg::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 27 of file Matcher.cc.
References NickPair::in_nick(), is_channel(), M_mt, debug::channels::dc::matcher, ServerSession::nicks(), ServerConnection::server(), and ServerSession::server_connection().
00028 { 00029 switch(M_mt) 00030 { 00031 case anystring_mt: 00032 return true; 00033 case nonemptystring_mt: 00034 return len > 0; 00035 case anyserver_mt: 00036 { 00037 for (char const* p = start; p < start + len; ++p) 00038 if (*p == '.') 00039 return true; 00040 return false; 00041 } 00042 case localserver_mt: 00043 { 00044 Dout(dc::matcher|continued_cf, "localserver_mt: get_irc_name() = \"" << 00045 server_session.server_connection().server()->get_irc_name() << "\"; input = \"" << buf2str(start, len) << "\", "); 00046 bool result = server_session.server_connection().server()->get_irc_name().compare(0, std::string::npos, start, len) == 0; 00047 Dout(dc::finish, "returning " << (result ? "true" : "false")); 00048 return result; 00049 } 00050 case anynick_mt: 00051 return len > 0 && !is_channel(start); 00052 case mynick_mt: 00053 { 00054 Dout(dc::matcher|continued_cf, "mynick_mt: server_in_nick() = \"" << 00055 server_session.nicks().in_nick() << "\"; input = \"" << buf2str(start, len) << "\", "); 00056 bool result = server_session.nicks().in_nick().compare(0, std::string::npos, start, len) == 0; 00057 Dout(dc::finish, "returning " << (result ? "true" : "false")); 00058 return result; 00059 } 00060 case anychannel_mt: 00061 return len > 0 && is_channel(start); 00062 case anyglobalchannel_mt: 00063 return len > 0 && *start == '#'; 00064 case anylocalchannel_mt: 00065 return len > 0 && *start == '&'; 00066 } 00067 // Never reached. 00068 return false; 00069 }
virtual int Matcher_noarg::sort_value | ( | void | ) | [inline, virtual] |
match0_type Matcher_noarg::M_mt [protected] |
The match type.
Definition at line 112 of file Matcher.h.
Referenced by match_impl(), and sort_value().
Copyright © 2005-2007 Carlo Wood. All rights reserved. |
---|