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 the read member (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 by begin and end (see below).
  • const_reverse_iterator β€” an reverse input iterator returned by the members rbegin and rend (see below).
  • const_hdr_iterator β€” an input iterator returned by the members beginh and endh (see below).
  • const_reverse_hdr_iterator β€” an reverse input iterator returned by the members rbeginh and rendh (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 to MailHeaders::READ, which makes the object start reading the e-mail immediately. if you set it to MailHeaders::DONT_READ, the e-mail is not read β€” and in that case you can call the member read to 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 the setHeaderIterator member.
  • const_iterator end() const β€” returns an iterator beyond the last line of the mail headers.
  • const_hdr_iterator endh() const β€” returns the end-iterator matching beginh. note that the member function's name ends in h, specifically to distinguish it from the vector<string>::end member. 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 the setHeaderIterator member.
  • void read() β€” reads the mail-headers from the file passed to the FBB::MailHeaders object's constructor. an 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). 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 matching rbeginh.
  • 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 member setHeaderIterator must have been called at least once, or the members beginh and rendh will throw an FBB::Exception exception. an FBB::Exception exception is also thrown if setHeaderIterator is 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 πŸŽ€

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 ⭐


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