DwAddress -- Abstract class representing an RFC-822 address
class DW_EXPORT DwAddress : public DwFieldBody { friend class DwAddressList; public: virtual ~DwAddress(); DwBool IsMailbox() const; DwBool IsGroup() const; inline DwBool IsValid() const; DwAddress* Next() const; void SetNext(DwAddress* aAddress); protected: DwAddress(); DwAddress(const DwAddress& aAddr); DwAddress(const DwString& aStr, DwMessageComponent* aParent=0); const DwAddress& operator = (const DwAddress& aAddr); int mIsValid; public: virtual void PrintDebugInfo(ostream& aStrm, int aDepth=0) const; virtual void CheckInvariants() const; protected: void _PrintDebugInfo(ostream& aStrm) const; };
DwAddress represents an address as described in RFC-822. You may not instantiate objects of type DwAddress, since DwAddress is an abstract base class. Instead, you must instantiate objects of type DwMailbox or DwGroup, which are subclasses of DwAddress.
To determine the actual type of a DwAddress object, you can use the member functions IsMailbox() and IsGroup().
If the string representation assigned to a DwAddress is improperly formed, the parse method will fail. To determine if the parse method failed, call the member function IsValid().
A DwAddress object can be contained in list. To get the next DwAddress object in the list, call the member function Next()
DwBool IsMailbox() const
Returns true value if this object is a DwMailbox.
DwBool IsGroup() const
Returns true value if this object is a DwGroup.
inline DwBool IsValid() const
Returns true value if the last parse was successful. Returns false if the last parse failed (bad address) or the Parse() member function was never called.
DwAddress* Next() const
Returns the next DwAddress object in the list when the object is included in a list of addresses. The function is used when iterating a list.
void SetNext(DwAddress* aAddress)
Sets the next DwAddress object in the list. This member function generally should not be used, since DwAddressList has member functions to manage its list of DwAddress objects.
virtual void PrintDebugInfo(ostream& aStrm, int aDepth=0) const
This virtual function, inherited from DwMessageComponent, prints debugging information about this object to aStrm. It will also call PrintDebugInfo() for any of its child components down to a level of aDepth.
This member function is available only in the debug version of the library.
virtual void CheckInvariants() const
Aborts if one of the invariants of the object fails. Use this member function to track down bugs.
This member function is available only in the debug version of the library.
DwAddress()
DwAddress(const DwAddress& aAddr)
DwAddress(const DwString& aStr, DwMessageComponent* aParent=0)
The first constructor is the default constructor, which sets the DwAddress object's string representation to the empty string and sets its parent to NULL.
The second constructor is the copy constructor, which copies the string representation and all attributes from aAddress. The parent of the new DwAddress object is set to NULL.
The third constructor copies aStr to the DwAddress object's string representation and sets aParent as its parent. The virtual member function Parse() should be called immediately after this constructor in order to parse the string representation. Unless it is NULL, aParent should point to an object of a class derived from DwField.
const DwAddress& operator = (const DwAddress& aAddr)
This is the assignment operator, which performs a deep copy of aAddr. The parent node of the DwAddress object is not changed.