1
//=============================================================================
3
// Contents: Declarations for DwMessage
4
// Maintainer: Doug Sauder <dwsauder@fwb.gulf.net>
5
// WWW: http://www.fwb.gulf.net/~dwsauder/mimepp.html
7
// Copyright (c) 1996, 1997 Douglas W. Sauder
8
// All rights reserved.
10
// IN NO EVENT SHALL DOUGLAS W. SAUDER BE LIABLE TO ANY PARTY FOR DIRECT,
11
// INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
12
// THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF DOUGLAS W. SAUDER
13
// HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
// DOUGLAS W. SAUDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT
16
// NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
17
// PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
18
// BASIS, AND DOUGLAS W. SAUDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
19
// SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
21
//=============================================================================
27
#include <mimelib/config.h>
31
#include <mimelib/entity.h>
34
//=============================================================================
35
//+ Name DwMessage -- Class representing an RFC-822/MIME message
37
//. {\tt DwMessage} represents an RFC-822/MIME {\it message}.
39
//. A {\it message} contains both a collection of {\it header fields} and
40
//. a {\it body}. In the terminology of RFC-2045, the general term for the
41
//. headers-body combination is {\it entity}. In MIME++, {\tt DwMessage}
42
//. is a direct subclass of {\tt DwEntity}, and therefore contains both
43
//. a {\tt DwHeaders} object and a {\tt DwBody} object.
45
//. In the tree (broken-down) representation of message, a {\tt DwMessage}
46
//. object is almost always a root node, having child nodes but no parent node.
47
//. The child nodes are the {\tt DwHeaders} object and the {\tt DwBody} object
48
//. it contains. A {\tt DwMessage} may sometimes be an intermediate node. In
49
//. this special case, the parent node is a {\tt DwBody} object of type
50
//. "message/*" and the {\tt DwMessage} object represents an encapsulated
53
//. To access the contained {\tt DwHeaders} object, use the inherited member
54
//. function {\tt DwEntity::Headers()}. To access the contained {\tt DwBody}
55
//. object, use the inherited member function {\tt DwEntity::Body()}.
56
//=============================================================================
57
// Last modified 1997-08-30
58
//+ Noentry ~DwMessage _PrintDebugInfo
60
class DW_EXPORT DwMessage : public DwEntity {
65
DwMessage(const DwMessage& aMessage);
66
DwMessage(const DwString& aStr, DwMessageComponent* aParent=0);
67
//. The first constructor is the default constructor, which sets the
68
//. {\tt DwMessage} object's string representation to the empty string
69
//. and sets its parent to {\tt NULL}.
71
//. The second constructor is the copy constructor, which performs
72
//. a deep copy of {\tt aMessage}.
73
//. The parent of the new {\tt DwMessage} object is set to {\tt NULL}.
75
//. The third constructor copies {\tt aStr} to the {\tt DwMessage}
76
//. object's string representation and sets {\tt aParent} as its parent.
77
//. The virtual member function {\tt Parse()} should be called immediately
78
//. after this constructor in order to parse the string representation.
82
const DwMessage& operator = (const DwMessage& aMessage);
83
//. This is the assignment operator, which performs a deep copy of
84
//. {\tt aMessage}. The parent node of the {\tt DwMessage} object
87
virtual DwMessageComponent* Clone() const;
88
//. This virtual function, inherited from {\tt DwMessageComponent},
89
//. creates a new {\tt DwMessage} on the free store that has the same
90
//. value as this {\tt DwMessage} object. The basic idea is that of
91
//. a ``virtual copy constructor.''
93
static DwMessage* NewMessage(const DwString& aStr,
94
DwMessageComponent* aParent);
95
//. Creates a new {\tt DwMessage} object on the free store.
96
//. If the static data member {\tt sNewMessage} is {\tt NULL},
97
//. this member function will create a new {\tt DwMessage}
98
//. and return it. Otherwise, {\tt NewMessage()} will call
99
//. the user-supplied function pointed to by {\tt sNewMessage},
100
//. which is assumed to return an object from a class derived from
101
//. {\tt DwMessage}, and return that object.
104
static DwMessage* (*sNewMessage)(const DwString&, DwMessageComponent*);
105
//. If {\tt sNewMessage} is not {\tt NULL}, it is assumed to point
106
//. to a user supplied function that returns an object from a class
107
//. derived from {\tt DwMessage}.
111
static const char* const sClassName;
115
virtual void PrintDebugInfo(std::ostream& aStrm, int aDepth=0) const;
116
//. This virtual function, inherited from {\tt DwMessageComponent},
117
//. prints debugging information about this object to {\tt aStrm}.
118
//. It will also call {\tt PrintDebugInfo()} for any of its child
119
//. components down to a level of {\tt aDepth}.
121
//. This member function is available only in the debug version of
126
void _PrintDebugInfo(std::ostream& aStrm) const;