The Bodypart class models a single MIME body part. It is a subclass of Multipart, and an adjunct to Message.
Every Bodypart has a number(), and contains text(), data(), or a message(), based on its contentType(). It knows how many numBytes(), numEncodedBytes() and numEncodedLines() of data it contains, and can present itself asText().
This class is also responsible for parsing bodyparts in messages.
Constructs a Bodypart with number n and parent p.
Constructs an empty Bodypart. This is meant to be used only by parseBodypart().
Returns the text representation of this Bodypart.
Notes: This function seems uncomfortable. It returns just one of many possible text representations, and the exact choice seems arbitrary, and finally, it does rather overlap with text() and data().
We probably should transition away from this function.
The exact representation returned uses base64 encoding for data types and no ContentTransferEncoding. For text types, it encodes the text according to the ContentType.
Returns the content transfer encoding of this Bodypart, which may be any of EString::Binary, EString::QuotedPrintable and EString::Base64.
Note that data() and text() return the canonical representation of the body, not encoded with this.
Returns the ContentType of this Bodypart, which may be a null pointer in case the Content-Type is the default one. The default is either text/plain or message/rfc822.
The Bodypart cannot find the default alone, since it depends on the surrounding type.
Returns this Bodypart's content, provided it has an 8-bit type. If this Bodypart is a text part, data() returns an empty string.
Returns an error message describing why this bodypart is bad, or an empty string if nothing seems to be the matter.
Returns the id of this bodypart in the bodyparts table, or 0 if it has not been stored there yet.
Returns a pointer to the subsidiary message, provided this is a message/rfc822 bodypart, or a null pointer in other cases.
Returns the number of bytes in this body part, as set using setNumBytes().
Returns the value set by setNumEncodedBytes(). Compare to numBytes().
Returns the number of lines in this body part, as set using setNumEncodedLines().
Returns a number that reflects this Bodypart's position within its containing Multipart.
Parses the part of rfc2822 from start to end (not including end) as a single bodypart with MIME/RFC 822 header h.
This removes the "charset" argument from the Content-Type field in h.
The parent argument is provided so that nested message/rfc822 bodyparts without a Date field may be fixed with reference to the Date field in the enclosing bodypart.
Parses the part of rfc2822 from index i to (but not including) end, dividing the part into bodyparts wherever the boundary divider occurs and adding each bodypart to children, and setting the correct parent. divider does not contain the leading or trailing hyphens. digest is true for multipart/digest and false for other types.
Sets the data of this Bodypart to s. For use only by MessageBodyFetcher for now.
Sets the id of this bodypart to id. Meant for use only by the Injector.
Notifies this Bodypart that it has a subsidiary message m. This function is only meaningful if the Bodypart has content-type message/rfc822.
Notifies this Bodypart that it contains n bytes of data(). The initial value is 0.
Notifies this Bodypart that it contains n bytes of asText() when fully encoded using the current ContentTransferEncoding. The initial value is 0.
Compare to numBytes(), which returns the raw number of bytes.
Notifies this Bodypart that it contains n lines of text() once encoded some ContentTransferEncoding. The initial value is 0.
Sets the text of this Bodypart to s. For use only by MessageBodyFetcher for now.
Returns the text of this Bodypart. MUST NOT be called for non-text parts (whose contents are not known to be well-formed text).
This web page based on source code belonging to The Archiveopteryx Developers. All rights reserved.