Inheritance diagram for Body:

Using the terms defined in RFC 2045, an entity contains a collection of header fields and a body. A message is an entity. A body part is also an entity. In Hunny MIME++, an Entity object contains a Headers object and a Body object. Message is a subclass of Entity. BodyPart is also a subclass of Entity.
If the primary content type of an entity is "multipart" (for example, "multipart/mixed"), then the body contains one or more body parts. If the content type is "message/rfc822", then the body contains an encapsulated message. For any content type, the body contains a string of characters or bytes. In Hunny MIME++, if the entity's primary content type is "multipart", then the Body object contains a collection of BodyPart objects. If the entity's content type is "message/rfc822", then the Body object contains a single Message object. For any content type, including "multipart" and "message/rfc822", the Body contains a string of characters or bytes, which is its string representation.
In the document tree representation of a message, a Body object can be an intermediate node, having both a parent node and one or more child nodes, or a leaf node, having a parent but no child nodes. In either case, the parent node is the Entity object that contains it. If it is an intermediate node, it must be of type "multipart" with BodyPart objects as child nodes, or of type "message/rfc822" with a single Message object as its child node. (See the man page for Node for a discussion of the tree representation of a message.)
Normally, you do not create a Body object directly, but you access it through the Entity::body() member function of Entity, which creates the Body object for you.
To add a BodyPart to a multipart Body, call the member function addBodyPart() or insertBodyPartAt(). To get the number of body parts, call numBodyParts(). To access a particular body part, call bodyPartAt(). To remove a single body part without deleting it, call removeBodyPartAt(). To remove and delete all body parts, call deleteAllBodyParts().
To get the Message object contained in a Body object with "message/rfc822" content type, call message(). To set the contained message, call setMessage().
Public Member Functions | |
| Body () | |
| Default constructor. | |
| Body (const Body &other) | |
| Copy constructor. | |
| Body (const String &str, Node *parent=0) | |
| Constructor that takes an initial string and parent node. | |
| virtual | ~Body () |
| Destructor. | |
| const Body & | operator= (const Body &other) |
| Assignment operator. | |
| virtual void | parse () |
| Parses the string representation. | |
| virtual void | assemble () |
| Assembles the string representation. | |
| virtual Node * | clone () const |
| Creates a copy of this object. | |
| int | numBodyParts () const |
| Gets the number of body parts in the list. | |
| void | addBodyPart (BodyPart *part) |
| Adds a body part to the end of the list. | |
| void | deleteAllBodyParts () |
| Deletes all body parts in the list. | |
| BodyPart & | bodyPartAt (int index) const |
| Gets the body part at the specified position in the list. | |
| void | insertBodyPartAt (int index, BodyPart *part) |
| Inserts a body part at the specified position in the list. | |
| BodyPart * | removeBodyPartAt (int index) |
| Removes the body part at the specified position in the list. | |
| Message * | message () const |
| Gets the contained message. | |
| void | setMessage (class Message *message) |
| Sets the contained message. | |
| const String & | preamble () const |
| Gets the preamble of a multipart body. | |
| void | setPreamble (const String &str) |
| Sets the preamble of a multipart body. | |
| const String & | epilogue () const |
| Gets the epilogue of a multipart body. | |
| void | setEpilogue (const String &str) |
| Sets the epilogue of a multipart body. | |
Static Public Member Functions | |
| Body * | newBody () |
| Creates a new instance. | |
Static Public Attributes | |
| Body *(* | sNewBody )() |
| Provides a class factory hook. | |
Protected Member Functions | |
| void | _copyBodyParts (const Body &body) |
| Copies all body parts from another list. | |
| void | _addBodyPart (BodyPart *bart) |
| Adds a body part to the end of the list. | |
| void | _insertBodyPartAt (int index, BodyPart *part) |
| Inserts a body part at the specified position in the list. | |
| BodyPart * | _removeBodyPartAt (int index) |
| Removes the body part at the specified position in the list. | |
| void | _deleteAllBodyParts () |
| Deletes all body parts in the list. | |
| void | _setMessage (class Message *message) |
| Sets the contained message. | |
|
|
This constructor sets the Body object's string representation to the empty string and sets its parent node to NULL. |
|
|
This constructor performs a deep copy of its argument. The parent node of the new Body object is set to NULL.
|
|
||||||||||||
|
This constructor sets the Body object's string representation to str and sets its parent node to parent. Normally, you call the virtual function parse() immediately after this constructor to create the broken-down representation.
|
|
|
Destructor |
|
|
Same as addBodyPart(), but does not set the is-modified flag.
|
|
|
Copies the list of BodyPart objects from body. Assumes the list in this Body object is emtpy. Does not set the is-modified flag.
|
|
|
Same as deleteAllBodyParts(), but does not set the is-modified flag.
|
|
||||||||||||
|
Same as insertBodyPartAt(), but does not set the is-modified flag.
|
|
|
Same as removeBodyPartAt(), but does not set the is-modified flag.
|
|
|
Same as setMessage(), but it does not set the is-modified flag.
|
|
|
Adds part to the end of the body part list. The Body destructor deletes the BodyPart objects in the list.
|
|
|
This virtual function, inherited from Node, executes the assemble operation for Body objects. The assemble operation creates or updates the string representation from the broken-down representation. If the content type of the containing entity is "multipart", then the assemble operation updates the string representation from the list of BodyPart objects that the Body contains. If the content type is "message/rfc822", then the assemble operation updates the string representation from the Message object that the Body contains. If the content type is not "multipart" or "message/rfc822", then the assemble operation does nothing. Note: If the Body object has no parent node -- that is, it is not contained by an Entity object -- then the assemble operation does nothing, since it is unable to determine the content type. You should call this member function after you add a BodyPart object to a multipart body, or add a Message object to a message body, and before you access the object's string representation. This function clears the is-modified flag. Implements Node. |
|
|
Gets the BodyPart object at position index in the body part list. The function's behavior is undefined if index is out of range. Valid values for index are 0 <= index < numBodyParts().
|
|
|
This virtual function, inherited from Node, creates a new Body object that has the same value as this Body object. The parent node of the new Body object is set to NULL.
Implements Node. |
|
|
Removes and deletes all BodyPart objects in the body part list. |
|
|
Gets the epilogue for a multipart body. The epliogue is the part of the body that follows the last body part. It is not normally shown in a message viewer, and is empty in most messages.
|
|
||||||||||||
|
Inserts part into the body part list at position index. If index is zero, then the function inserts part into the first position in the list. If index equals numBodyParts(), then the function inserts part into the last position in the list. If index is less than numBodyParts(), then the function moves the BodyPart objects at position index or greater to a higher position in the list. The Body destructor deletes the BodyPart objects in the list. The function's behavior is undefined if index is out of range. Valid values for index are 0 <= index <= numBodyParts().
|
|
|
Gets the contained Message object.
|
|
|
Creates a new Body object. If the static data member sNewBody is NULL, this member function creates a new Body object and returns it. Otherwise, newBody() calls the user-supplied function that sNewBody points to and returns the object created by that function.
|
|
|
Gets the number of BodyPart objects in the body part list.
|
|
|
Performs a deep copy of its argument. The parent node of this Body object is not changed.
|
|
|
This virtual function, inherited from Node, executes the parse operation for Body objects. The parse operation creates or updates the broken-down representation from the string representation. If the content type of the containing entity is "multipart", the parse operation creates a list of BodyPart objects to represent the body parts that the body contains. If the content type is "message/rfc822", the parse operation creates a single Message object to represent the encapsulated message. If the content type is not "multipart" or "message/rfc822", the parse operation does nothing. Note: If the Body object has no parent node -- that is, it is not contained by an Entity object -- then the parse operation does nothing, since it is unable to determine the content type. You should call this member function after you set or modify the string representation, and before you access a contained BodyPart or Message. This function clears the is-modified flag. Implements Node. |
|
|
Gets the preamble for a multipart body. The preamble is the part of the body that precedes the first body part. It is not normally shown in a message viewer, and usually contains a message that's meaningful to users of non-MIME capable message viewers.
|
|
|
Removes the BodyPart object at position index from the body part list and returns it. If index is less than numBodyParts()-1, then the function moves the BodyPart objects at position (index + 1) or greater to a lower position in the list. The function's behavior is undefined if index is out of range. Valid values for index are 0 <= index < numBodyParts().
|
|
|
Sets the epliogue for a multipart body. The epilogue is the part of the body that follows the last body part. It is not normally shown in a message viewer, and is empty in most messages.
|
|
|
Sets the contained Message object. The Message object will be destroyed by the Body object's destructor.
|
|
|
Sets the preamble for a multipart body. The preamble is the part of the body that precedes the first body part. It is not normally shown in a message viewer, and usually contains a message that's meaningful to users of non-MIME capable message viewers.
|
|
|
If sNewBody is not NULL, it must point to a user-supplied function that returns a new instance of a subclass of Body.
|
Copyright © 2001-2007 Hunny Software, Inc. All rights reserved.