Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

rfc822::filter::conditional Class Reference

Checks conditions. More...

#include <filter.h>

Inheritance diagram for rfc822::filter::conditional::

rfc822::filter::filter List of all members.

Public Methods

 conditional ()
 creates the rfilter object. More...

 conditional (const string &condition, bool fAllSlots=false)
 creates the rfilter object. More...

 ~conditional ()
 d'tor. More...

conditional & set (const string &condition, bool fAllSlots=false)
 sets a condition. More...

 operator bool () const
 returns true if the conditional is ready to work. More...

void onMsg (const rfc822::msg &msg)
 handles incoming messages. More...


Detailed Description

Checks conditions.

filter objects of this class are able to filter messages according a more or less complex condition.

Conditions are set as strings, and must be formed according the following syntax:

condition:      <condition> <and> <condition>
        |               <condition> <or> <condition>
        |               ( <condition> )
        |               ! <condition>
        |               ID <op> STRING
        ;

and:    "&&" | /AND/i ;

or:             "||" | /OR/i ;


        
op:             "==" | /IS/i | /EQUALS/i                                // equality 
        |       "!=" | /IS +NOT/i                                               // inequality 
        |       "=~" | /MATCH(ES)?/i                                    // regex match 
        |       "!~" | /(DOES +)?NOT +MATCH(ES)?/i              // regex no match 
        |       "=#" | /CONTAIN(S)?/i                                   // containment 
        |       "!#" | /(DOES +)?NOT +CONTAIN(S)?/i             // uncontainment 
        ;
        
id:                     [A-Za-z][A-Za-z0-9_\-]*(\.[A-Za-z0-9_\-])*
string:         (\"|\/)([^$1]|(\\$1))*$1 
For example, the following conditions are legal: Conditions are evaluated at runtime by matching the appropriate header entries or the body of the message against the string. It is not possible to match two strings or two header entries. The operations are always evaluated case insensitively. If a message passes the condition it is redirected to the default slot; if it does not pass it, and the conditional object was created with fAllSlots, the object is redirected to the "no" slot.


Constructor & Destructor Documentation

rfc822::filter::conditional::conditional  
 

creates the rfilter object.

rfc822::filter::conditional::conditional const string   condition,
bool    fAllSlots = false
 

creates the rfilter object.

Parameters:
condition  the condition to check.
fAllSlots  when set, a message which does not pass the condition, is redirected to the "no" slot.

rfc822::filter::conditional::~conditional  
 

d'tor.


Member Function Documentation

void rfc822::filter::conditional::onMsg const rfc822::msg   msg
 

handles incoming messages.

rfc822::filter::conditional::operator bool   const [inline]
 

returns true if the conditional is ready to work.

conditional& rfc822::filter::conditional::set const string   condition,
bool    fAllSlots = false
 

sets a condition.

Parameters:
condition  the condition to check.
fAllSlots  when set, a message which does not pass the condition, is redirected to the "no" slot.
You should check the object after that via the operator bool() method, as setting the condition fails on illegal syntax in the condition parameter or when trying to define an illegal regular expression, or when trying to define a regular expression when no regex support is compiled in the library.


The documentation for this class was generated from the following file:
Generated on Mon Oct 22 17:03:48 2001 for rfc822 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001