1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
|
includefile(include/header)
COMMENT(manpage, section, releasedate, archive, short name)
manpage(FBB::MailHeaders)(3bobcat)(_CurYrs_)(libbobcat-dev__CurVers_)
(SMTP Mail Headers)
manpagename(FBB::MailHeaders)(Handles SMTP Mail Headers)
manpagesynopsis()
bf(#include <bobcat/mailheaders>)nl()
Linking option: tt(-lbobcat)
manpagedescription()
bf(FBB::MailHeaders) objects extract header lines from e-mail. Reading
stops at (and including) the first blank line, which becomes the last element
of the bf(FBB::MailHeaders) object, interpreted as a bf(vector). The actual
e-mail content is therefore left unread on the file containing the e-mail.
Each line stored in a bf(MailHeaders) object represents a complete header
line. Headers continuing over multiple input lines are concatenated to a
single line retrievable from bf(MailHeaders) objects, separated from each
other by tt('\n') (newline) characters. The last line to join a multi-line
header is not terminated by a newline character.
includefile(include/namespace)
manpagesection(INHERITS FROM)
-
manpagesection(ENUMERATIONS)
The following enumerations and enumeration values can be used with the
class bf(FBB::MailHeaders):
bf(enum Mode)nl()
This enumeration defines two values:
itemization(
itb(READ)
When this value is specified at construction time, e-mail is
immediately read by the constructor.
itb(DONT_READ)
When this value is specified at construction time, e-mail is read
using the tt(read) member (see below).
)
bf(enum Match)nl()
This enumeration defines the following values:
itemization(
itb(FULL)
Used by tt(setHeaderIterator) (see below) to indicate that the
headers must exactly match a specified header name.
itb(INITIAL)
Used by tt(setHeaderIterator) (see below) to indicate that the
initial part of the headers must match the specified header text.
itb(PARTIAL)
Used by tt(setHeaderIterator) (see below) to indicate that the
headers must contain the specified header text.
itb(CASE_FULL)
Used by tt(setHeaderIterator) (see below) to indicate that the
headers must exactly match a specified header name. The matching is performed
case insensititvely.
itb(CASE_INITIAL)
Used by tt(setHeaderIterator) (see below) to indicate that the
initial part of the headers must match the specified header text. The matching
is performed case insensititvely.
itb(CASE_PARTIAL)
Used by tt(setHeaderIterator) (see below) to indicate that the
headers must contain the specified header text. The matching is performed case
insensititvely.
)
manpagesection(NESTED TYPES)
The class tt(MailHeaders) defines the following types:
itemization(
itb(const_iterator)
An input iterator returned by tt(begin) and tt(end) (see
below)
itb(const_reverse_iterator)
An reverse input iterator returned by the members tt(rbegin) and
tt(rend) (see below)
itb(const_hdr_iterator)
An input iterator returned by the members tt(beginh) and tt(endh) (see
below)
itb(const_reverse_hdr_iterator)
An reverse input iterator returned by the members tt(rbeginh) and
tt(rendh) (see below)
)
Objects of these two iterator types point to header lines. Their
dereferenced type is tt(std::string).
manpagesection(CONSTRUCTORS)
itemization(
itb(MailHeaders(std::istream &in, Mode mode = READ))
This constructor defines the file containing the e-mail to be
processed. The second parameter is by default bf(MailHeaders::READ), causing
the object to start reading the e-mail immediately. If set to
bf(MailHeaders::DONT_READ), the e-mail is not read. In that case the member
tt(read) can be called to process the e-mail later.
)
The move constructor and move assignment operator is available.
manpagesection(OVERLOADED OPERATORS)
itemization(
itb(std::string const &operator[](size_t idx) const)
Returns the tt(idx)-th header line
)
manpagesection(MEMBER FUNCTIONS)
itemization(
itb(const_iterator begin() const)
Returns an iterator to the first line of the mail headers.
itb(const_hdr_iterator beginh() const)
Returns the begin-iterator corresponding to the first header selected by
the tt(setHeaderIterator) member.
itb(const_iterator end() const)
Returns an iterator beyond the last line of the mail headers.
itb(const_hdr_iterator endh() const)
Returns the end-iterator matching tt(beginh). Note that the member
function's name ends in tt(h), to distinguish it from the
tt(vector<string>::end) member.
itb(const_reverse_iterator rbegin() const)
Returns an iterator to the last line of the mail headers.
itb(const_reverse_hdr_iterator rbeginh() const)
Returns the reversed begin-iterator corresponding to the last header
selected by the tt(setHeaderIterator) member.
itb(void read())
Reads the mail-headers from the file passed to the bf(FBB::MailHeaders)
object's constructor. An bf(FBB::Exception) object is thrown if the mailheaders
were already read or if the file is incomplete (i.e., the (obligatory) blank
line wasn't found).
itb(const_iterator rend() const)
Returns an iterator before the first line of the mail headers.
itb(const_reverse_hdr_iterator rendh() const)
Returns the reversed end-iterator matching tt(rbeginh).
itb(void setHeaderIterator(char const *header, Match match = FULL))
Sets the header-iterators to the specified tt(header). The parameter
tt(match) defines the match-type to use when selecting headers. The default
bf(FBB::MailHeaders::FULL), indicates that the text provided in
tt(header) must match exactly an e-mail header. nl()
When matching headers the
colon terminating the header is em(not) considered and should therefore
em(not) be specified by tt(setHeaderIterator). nl()
Alternative matching strategies are used when other values of
the enumeration bf(FBB::Match) are specified.nl()
The member tt(setHeaderIterator) em(must) have been called at least once
or the members tt(beginh) and tt(rendh) will throw an bf(FBB::Exception)
exception. An bf(FBB::Exception) exception is also thrown if
tt(setHeaderIterator) is called when no mail headers are available.
itb(size_t size() const)
Returns the number of header lines
)
manpagesection(EXAMPLE)
The following example shows the normal use of these members:
verb(
// create a MailHeader object
MailHeaders mh(cin, MailHeaders::DONT_READ);
try
{ // read the headers
mh.read();
}
catch (Exception &err)
{
cout << err.what() << endl;
}
cout << "There are " << mh.size() << " header lines\n";
// look for the Received: headers
mh.setHeaderIterator("Received");
// show the Received headers
copy(mh.beginh(), mh.endh(),
ostream_iterator<std::string const>(cout, "\n"));
)
manpagefiles()
em(bobcat/mailheaders) - defines the class interface
manpageseealso()
bf(bobcat)(7)
manpagebugs()
None Reported.
includefile(include/trailer)
|