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

rfc822::parser Class Reference

a somewhat RFC822 compatible entry parser. More...

#include <parser.h>

List of all members.

Public Methods

 parser ()
 c'tor. More...

virtual ~parser ()
 d'tor. More...

virtual bool parse (const string &s)
 parses an entry. More...

virtual const stringgetValue (const string &item)
 returns a special value. More...


Static Public Attributes

string undef
 a dummy return value. More...


Protected Types

enum  { text = 0, special, comment }

Protected Methods

virtual bool onToken (const char *t, int mode)
 Callback for the parse() method. More...

virtual bool error (const string &err)
 called on error. More...

void registerParser (const string &name)
 registers this parser for a certain item. More...


Detailed Description

a somewhat RFC822 compatible entry parser.

The header class uses objects of this class or derivees to handle entry-specific parsings, for example, when parsing a "From:" line into realname and email address, or parsing the "Date:" line into somewhat machine readable.

Normally you would not need to instantiate such a class.


Member Enumeration Documentation

anonymous enum [protected]
 

Enumeration values:
text 
special 
comment 


Constructor & Destructor Documentation

rfc822::parser::parser  
 

c'tor.

virtual rfc822::parser::~parser   [virtual]
 

d'tor.


Member Function Documentation

virtual bool rfc822::parser::error const string   err [protected, virtual]
 

called on error.

virtual const string& rfc822::parser::getValue const string   item [virtual]
 

returns a special value.

When, as usual, used and registered as a helper class for the rfc822::header class, the rfc822::header methods will call this method to query the special value. For example, the "From:" parser implements return values for "from.email" and "from.realname".

Parameters:
item  the name of the item
Returns:
The queried value or undef when called for an invalid item.

virtual bool rfc822::parser::onToken const char *    t,
int    mode
[protected, virtual]
 

Callback for the parse() method.

Parameters:
t  the token
mode  one of parser::text, parser::special, and parser::comment.
Returns:
true on success, false on illegal tokens.

virtual bool rfc822::parser::parse const string   s [virtual]
 

parses an entry.

The default implementation parses the entries value into text, specials, and comments in a way similar to what RFC822 describes. It then feeds the tokens into the onToken() method.

Returns:
true on success.

void rfc822::parser::registerParser const string   name [inline, protected]
 

registers this parser for a certain item.

This method is a shortcut for calling header::registerSpecial().


Member Data Documentation

string rfc822::parser::undef [static]
 

a dummy return value.


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