1 //=============================================================================
3 // Contents: Definitions for DwAddress
4 // Maintainer: Doug Sauder <dwsauder@fwb.gulf.net>
5 // WWW: http://www.fwb.gulf.net/~dwsauder/mimepp.html
9 // Copyright (c) 1996, 1997 Douglas W. Sauder
10 // All rights reserved.
12 // IN NO EVENT SHALL DOUGLAS W. SAUDER BE LIABLE TO ANY PARTY FOR DIRECT,
13 // INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
14 // THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF DOUGLAS W. SAUDER
15 // HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17 // DOUGLAS W. SAUDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT
18 // NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
19 // PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
20 // BASIS, AND DOUGLAS W. SAUDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
21 // SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23 //=============================================================================
25 #define DW_IMPLEMENTATION
27 #include <mimelib/config.h>
28 #include <mimelib/debug.h>
32 #include <mimelib/address.h>
33 #include <mimelib/token.h>
34 #include <mimelib/group.h>
35 #include <mimelib/mailbox.h>
37 const char* const DwAddress::sClassName
= "DwAddress";
40 DwAddress::DwAddress()
44 mClassId
= kCidAddress
;
45 mClassName
= sClassName
;
49 DwAddress::DwAddress(const DwAddress
& aAddr
)
52 mIsValid
= aAddr
.mIsValid
;
54 mClassId
= kCidAddress
;
55 mClassName
= sClassName
;
59 DwAddress::DwAddress(const DwString
& aStr
, DwMessageComponent
* aParent
)
60 : DwFieldBody(aStr
, aParent
)
64 mClassId
= kCidAddress
;
65 mClassName
= sClassName
;
69 DwAddress::~DwAddress()
74 const DwAddress
& DwAddress::operator = (const DwAddress
& aAddr
)
76 if (this == &aAddr
) return *this;
77 DwFieldBody::operator = (aAddr
);
78 mIsValid
= aAddr
.mIsValid
;
83 DwBool
DwAddress::IsMailbox() const
85 DwBool r
= (mClassId
== kCidMailbox
) ? 1 : 0;
90 DwBool
DwAddress::IsGroup() const
92 DwBool r
= (mClassId
== kCidGroup
) ? 1 : 0;
97 DwAddress
* DwAddress::Next() const
103 void DwAddress::SetNext(DwAddress
* aAddress
)
109 #if defined (DW_DEBUG_VERSION)
110 void DwAddress::PrintDebugInfo(std::ostream
& aStrm
, int /*aDepth*/) const
113 "---------------- Debug info for DwAddress class ----------------\n";
114 _PrintDebugInfo(aStrm
);
117 void DwAddress::PrintDebugInfo(std::ostream
&, int ) const {}
118 #endif // defined (DW_DEBUG_VERSION)
121 #if defined (DW_DEBUG_VERSION)
122 void DwAddress::_PrintDebugInfo(std::ostream
& aStrm
) const
124 DwFieldBody::_PrintDebugInfo(aStrm
);
125 aStrm
<< "IsValid: ";
132 aStrm
<< "Next address: ";
134 aStrm
<< mNext
->ObjectId() << '\n';
141 void DwAddress::_PrintDebugInfo(std::ostream
& ) const {}
142 #endif // defined (DW_DEBUG_VERSION)
145 void DwAddress::CheckInvariants() const
147 #if defined (DW_DEBUG_VERSION)
148 DwFieldBody::CheckInvariants();
149 #endif // defined (DW_DEBUG_VERSION)