CVS_SILENT Removing not needed accelerators (<property name="accel">) from ui files...
[kdepim.git] / mimelib / address.cpp
blob50877a708b382776fb667ab94244080811ec31d7
1 //=============================================================================
2 // File: address.cpp
3 // Contents: Definitions for DwAddress
4 // Maintainer: Doug Sauder <dwsauder@fwb.gulf.net>
5 // WWW: http://www.fwb.gulf.net/~dwsauder/mimepp.html
6 // $Revision$
7 // $Date$
8 //
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>
29 #include <ctype.h>
30 #include <stdlib.h>
31 #include <string.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()
42 mIsValid = 0;
43 mNext = 0;
44 mClassId = kCidAddress;
45 mClassName = sClassName;
49 DwAddress::DwAddress(const DwAddress& aAddr)
50 : DwFieldBody(aAddr)
52 mIsValid = aAddr.mIsValid;
53 mNext = 0;
54 mClassId = kCidAddress;
55 mClassName = sClassName;
59 DwAddress::DwAddress(const DwString& aStr, DwMessageComponent* aParent)
60 : DwFieldBody(aStr, aParent)
62 mIsValid = 0;
63 mNext = 0;
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;
79 return *this;
83 DwBool DwAddress::IsMailbox() const
85 DwBool r = (mClassId == kCidMailbox) ? 1 : 0;
86 return r;
90 DwBool DwAddress::IsGroup() const
92 DwBool r = (mClassId == kCidGroup) ? 1 : 0;
93 return r;
97 DwAddress* DwAddress::Next() const
99 return mNext;
103 void DwAddress::SetNext(DwAddress* aAddress)
105 mNext = aAddress;
109 #if defined (DW_DEBUG_VERSION)
110 void DwAddress::PrintDebugInfo(std::ostream& aStrm, int /*aDepth*/) const
112 aStrm <<
113 "---------------- Debug info for DwAddress class ----------------\n";
114 _PrintDebugInfo(aStrm);
116 #else
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: ";
126 if (mIsValid) {
127 aStrm << "True\n";
129 else {
130 aStrm << "False\n";
132 aStrm << "Next address: ";
133 if (mNext) {
134 aStrm << mNext->ObjectId() << '\n';
136 else {
137 aStrm << "(none)\n";
140 #else
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)