Main Page | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

Entity Class Reference

Inheritance diagram for Entity:

Node BodyPart Message List of all members.

Detailed Description

RFC 2045 defines an entity as either a message or a body part, both of which have a collection of header fields and a body. In Hunny MIME++, an entity is represented by the class Entity, which contains both a Headers object and a Body object.

In the document tree representation of a message, an Entity object may be either a root node, having child nodes but no parent node, or an intermediate node, having both a parent node and child nodes. An Entity object that is a root node should be a Message object. If an Entity object is an intermediate node, its parent should be a Body object. The child nodes of an Entity object are the Headers and Body objects it contains.

Since Entity is an abstract base class, you cannot create instances of it directly. Entity has two derived classes, Message and BodyPart, which are concrete classes.

To access the contained Headers object, use the member function headers(). To access the contained Body object, use the member function body().


Public Member Functions

 Entity ()
 Default constructor.
 Entity (const Entity &other)
 Copy constructor.
 Entity (const String &str, Node *parent=0)
 Constructor that takes an initial string and parent node.
virtual ~Entity ()
 Destructor.
const Entityoperator= (const Entity &other)
 Assignment operator.
virtual void parse ()
 Parses the string representation.
virtual void assemble ()
 Assembles the string representation.
Headersheaders () const
 Gets the header fields of the entity.
Bodybody () const
 Gets the body of the entity.


Constructor & Destructor Documentation

Entity  ) 
 

This constructor sets the Entity object's string representation to the empty string and sets its parent node to NULL.

Entity const Entity other  ) 
 

This constructor performs a deep copy of its argument. The parent node of the new Entity object is set to NULL.

Parameters:
other Entity instance to copy

Entity const String str,
Node parent = 0
 

This constructor sets the Entity 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.

Parameters:
str initial value for the string representation
parent parent node for this object

~Entity  )  [virtual]
 

Destructor


Member Function Documentation

void assemble  )  [virtual]
 

This virtual function, inherited from Node, executes the assemble operation for Entity objects. The assemble operation creates or updates the string representation from the broken-down representation. For Entity objects, the assemble operation builds the string representation from the contained Headers and Body objects. Before it builds the string representation for the Entity object, this member function calls the assemble() member functions of the contained Headers and Body objects.

You should call this member function after you modify either the contained headers or body, and before you retrieve the string representation.

This function clears the is-modified flag.

Implements Node.

Body & body  )  const
 

Gets the body of the entity.

Returns:
reference to the contained Body object

Headers & headers  )  const
 

Gets the header fields of the entity.

Returns:
reference to the contained Headers object

const Entity & operator= const Entity other  ) 
 

Performs a deep copy of its argument. The parent node of this Entity object is not changed.

Parameters:
other Entity instance to copy

void parse  )  [virtual]
 

This virtual function, inherited from Node, executes the parse operation for Entity objects. The parse operation creates or updates the broken-down representation from the string representation. For Entity objects, the parse operation parses the string representation and sets the values of the Headers and Body objects it contains. This member function also calls the parse() member functions of the contained Headers and Body objects.

You should call this member function after you set or modify the string representation, and before you access either the contained headers or body.

This function clears the is-modified flag.

Implements Node.

Copyright © 2001-2007 Hunny Software, Inc. All rights reserved.