#include <mbox.h>
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 |
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; }
|
c'tor. This reads in a mbox file.
|
|
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.
|
|
d'tor.
|
|
returns the first iterator in the collection.
|
|
returns the last iterator in the collection.
|
|
|