NAME

DwAddress -- Abstract class representing an RFC-822 address

SYNOPSIS

class DW_CORE_EXPORT DwAddress : public DwFieldBody {

public:

    virtual ~DwAddress();
    DwBool IsMailbox() const;
    DwBool IsGroup() const;
    DwBool IsValid() const;

protected:

    DwAddress();
    DwAddress(const DwAddress& aAddr);
    DwAddress(const DwString& aStr, DwMessageComponent* aParent=0);
    const DwAddress& operator = (const DwAddress& aAddr);
    DwBool mIsValid;

public:

    virtual void PrintDebugInfo(DW_STD ostream& aStrm, int aDepth=0) const;
    virtual void CheckInvariants() const;

protected:

    void _PrintDebugInfo(DW_STD ostream& aStrm) const;
};

DESCRIPTION

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().

Public Member Functions

DwBool IsMailbox() const

Returns true value if this object is a DwMailbox.

DwBool IsGroup() const

Returns true value if this object is a DwGroup.

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.

virtual void PrintDebugInfo(DW_STD 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.

Protected Member Functions

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.