FBB::MailHeaders(3bobcat)
π FBB::MailHeaders β the bobcat mail-headers era π
okay bestie, welcome to FBB::MailHeaders(3bobcat), the little bobcat page that handles SMTP Mail Headers β yes, literally, that's the NAME section and it's giving exactly what it says on the tin π
β¨ NAME β¨
FBB::MailHeaders β handles SMTP Mail Headers π¦
πΈ SYNOPSIS πΈ
#include <bobcat/mailheaders>
Linking option: -lbobcat
π DESCRIPTION π
so FBB::MailHeaders objects pull header lines out of an e-mail. reading stops at (and including) the first blank line, and that blank line becomes the last element of the FBB::MailHeaders object, which you should lowkey read as a vector. so the actual e-mail content? left unread on the file containing the e-mail. we don't touch it, we don't look at it, not our business π
each line stored in a MailHeaders object is a complete header line, no cap. and headers that continue over multiple input lines get concatenated into a single line you can retrieve from MailHeaders objects, separated from each other by '\n' (newline) characters. the last line joining a multi-line header is not terminated by a newline character. periodt β¨
π NAMESPACE π
FBB
every single constructor, member, operator and manipulator mentioned in this man-page is defined in the namespace FBB. iconic behaviour honestly.
π INHERITS FROM π
-
(yeah it inherits from nothing, it's its own main character π )
π ENUMERATIONS π
these enumerations and enumeration values can be used with the class FBB::MailHeaders:
enum Mode
this one defines two values:
READβ when this value is specified at construction time, e-mail is immediately read by the constructor. instant gratification π₯DONT_READβ when this value is specified at construction time, e-mail is read using thereadmember (see below). we wait, we're patient, we're chill π§
enum Match
this one defines these values, and they all get used by setHeaderIterator (see below):
FULLβ headers must exactly match a specified header name.INITIALβ the initial part of the headers must match the specified header text.PARTIALβ the headers must contain the specified header text.CASE_FULLβ headers must exactly match a specified header name, but the matching is performed case insensititvely. (yes, matching, case-insensitive, slay π )CASE_INITIALβ the initial part of the headers must match the specified header text, and the matching is performed case insensititvely.CASE_PARTIALβ the headers must contain the specified header text, and the matching is performed case insensititvely.
π¦ NESTED TYPES π¦
MailHeaders defines these types:
const_iteratorβ an input iterator returned bybeginandend(see below).const_reverse_iteratorβ an reverse input iterator returned by the membersrbeginandrend(see below).const_hdr_iteratorβ an input iterator returned by the membersbeginhandendh(see below).const_reverse_hdr_iteratorβ an reverse input iterator returned by the membersrbeginhandrendh(see below).
objects of these two iterator types point to header lines. their dereferenced type is std::string β
π CONSTRUCTORS π
MailHeaders(std::istream &in, Mode mode = READ)β this constructor defines the file containing the e-mail to be processed. the second parameter defaults toMailHeaders::READ, which makes the object start reading the e-mail immediately. if you set it toMailHeaders::DONT_READ, the e-mail is not read β and in that case you can call the memberreadto process the e-mail later. your timing, your call π«Ά
the move constructor and move assignment operator is available. yup, it moves, that's the whole vibe.
π OVERLOADED OPERATORS π
std::string const &operator[](size_t idx) constβ returns the idx-th header line. index it, bestie π
π MEMBER FUNCTIONS π
const_iterator begin() constβ returns an iterator to the first line of the mail headers.const_hdr_iterator beginh() constβ returns the begin-iterator corresponding to the first header selected by thesetHeaderIteratormember.const_iterator end() constβ returns an iterator beyond the last line of the mail headers.const_hdr_iterator endh() constβ returns the end-iterator matchingbeginh. note that the member function's name ends inh, specifically to distinguish it from thevector<string>::endmember. iykyk πconst_reverse_iterator rbegin() constβ returns an iterator to the last line of the mail headers.const_reverse_hdr_iterator rbeginh() constβ returns the reversed begin-iterator corresponding to the last header selected by thesetHeaderIteratormember.void read()β reads the mail-headers from the file passed to theFBB::MailHeadersobject's constructor. anFBB::Exceptionobject is thrown if the mailheaders were already read, or if the file is incomplete (i.e., the (obligatory) blank line wasn't found). so rude, but okay πconst_iterator rend() constβ returns an iterator before the first line of the mail headers.const_reverse_hdr_iterator rendh() constβ returns the reversed end-iterator matchingrbeginh.void setHeaderIterator(char const *header, Match match = FULL)β sets the header-iterators to the specified header. the parameter match defines the match-type to use when selecting headers. the default,FBB::MailHeaders::FULL, indicates that the text provided in header must match exactly an e-mail header.
when matching headers, the colon terminating the header is not considered, so you should not specify it in setHeaderIterator. alternative matching strategies are used when other values of the enumeration FBB::Match are specified.
β οΈ bestie listen β the membersetHeaderIteratormust have been called at least once, or the membersbeginhandrendhwill throw anFBB::Exceptionexception. anFBB::Exceptionexception is also thrown ifsetHeaderIteratoris called when no mail headers are available. no headers, no iterator, that's the rule π
size_t size() constβ returns the number of header lines. π
π EXAMPLE π
the following example shows the normal use of these members:
// 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"));
πΈ FILES πΈ
bobcat/mailheadersβ defines the class interface.
π« SEE ALSO π«
π BUGS π
None Reported.
(nothing to report, we're flawless, we ate and left no crumbs π)
π BOBCAT PROJECT FILES π
- https://fbb-git.gitlab.io/bobcat/ β gitlab project page;
Debian Bobcat project files:
libbobcat6β debian package containing the shared library, changelog and copyright note;libbobcat-devβ debian package containing the static library, headers, manual pages, and developer info;
π BOBCAT π
Bobcat is an acronym of Brokken's Own Base Classes And Templates. an acronym that ate fr fr β
π COPYRIGHT π
This is free software, distributed under the terms of the GNU General Public License (GPL). free software is the moment, cherish it π«Ά
β¨ AUTHOR β¨
Frank B. Brokken (f.b.brokken@rug.nl). thank you king π
and that's the whole page bestie, no notes, you understood it perfectly π
libbobcat-dev_6.15.01 Β· 2005-2026 Β· FBB::MailHeaders(3bobcat) β mwah, go read some headers π¦πβ¨
π¦ where this page comes from
- ubuntu stonking: libbobcat-dev 6.15.01-1 Β· GPL-3.0-or-later WITH OpenSSL exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms