#include <header.h>
Public Methods | |
header () | |
c'tor. More... | |
header (const string &h) | |
copy c'tor. More... | |
header (const header &h) | |
copy c'tor. More... | |
header (const msg &h) | |
creation from a message. More... | |
header & | operator= (const header &h) |
assignment operator. More... | |
header & | operator= (const string &h) |
set the eader. More... | |
const string & | operator[] (const string &id) const |
returns the specified header entry. More... | |
entry | operator[] (const string &name) |
Friends | |
class | header::entry |
class | parser |
ostream & | operator<< (ostream &, const header &) |
The header class contains a parsed header, which enables fast access to individual header entries.
One can access entries via the [] operators. Even values are defined that do not match exactly one entry. For example, the "from.email" entry will contain the email address from the "From: " header field.
Values like a "from.email" value are handled by certain specialized parsers, that are able to extract relevant information off a header entry and convert it into a format which is easy to handle. For example, "from.email" contains the email address of the "From: " header line, and "date.unix" contains the # of seconds since epoch of the "Date: " header field.
However, these entry parsers must be instantiated before parsing. A set of parsers is defined in the src/header.cpp source file. approbiate entry
// // 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.
|
|
copy c'tor.
|
|
copy c'tor.
|
|
creation from a message.
|
|
set the eader. When the text is set (this usually occurs behind the curtain: You don't have to call that method) the text is parsed into its individual lines, and then stored under a key derived from the entries name. |
|
assignment operator.
|
|
|
|
returns the specified header entry.
|
|
|
|
|
|
|