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

rfc822::mbox Class Reference

UNIX style mbox file parser. More...

#include <mbox.h>

List of all members.

Public Methods

 mbox (const string &file)
 c'tor. More...

 mbox (istream &in)
 c'tor. More...

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

iterator begin ()
 returns the first iterator in the collection. More...

iterator end () const
 returns the last iterator in the collection. More...


Friends

class iterator


Detailed Description

UNIX style mbox file parser.

This class cuts a mbox file into single RFC822 compliant messages, that are accessed via mbox_iterators. However, as opposed to a STL list (which is accessed via iterators in a similar way), the mbox class loads and parses each message at individual request (via the iterator). Therefore, it holds only a single message per iterator, and does not provide a method that returns the # of messages in the mbox.

If you need random or similar access to individual messages you should store the messages into a separate structure. You also should avoid to iterate over the mbox using two or more independent iterators, as this would do MBOX parsing for several times.

Usage:

//
// load mbox file...
rfc822::mbox mails(*argv);

//
// ...and iterate over all messages
for(rfc822::mbox::iterator it = mails.begin();
        it != mails.end(); ++it)
        {
                rfc822::header& h = it->header;
                cout << "From " << '\"' <<  h["from"] << '\"' << endl;
                cout << "\t\"" <<  h["from.realname"] << '\"' << endl;
                cout << "\t\"" <<  h["from.email"] << '\"' << endl;
        }


Constructor & Destructor Documentation

rfc822::mbox::mbox const string   file
 

c'tor.

This reads in a mbox file.

Parameters:
file  the name of the file.

rfc822::mbox::mbox istream &    in
 

c'tor.

This reads in a mbox file from a stream, for example from cin when a mbox file is run over a pipe filter.

Parameters:
in  the input stream.

rfc822::mbox::~mbox  
 

d'tor.


Member Function Documentation

iterator rfc822::mbox::begin   [inline]
 

returns the first iterator in the collection.

iterator rfc822::mbox::end   const [inline]
 

returns the last iterator in the collection.


Friends And Related Function Documentation

friend class iterator [friend]
 


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