## NAME

DwText -- Class representing text in a RFC-822 header field-body

## SYNOPSIS

    class DW_EXPORT DwText : public DwFieldBody {

    public:

        DwText();
        DwText(const DwText& aText);
        DwText(const DwString& aStr, DwMessageComponent* aParent=0);
        virtual ~DwText();
        const DwText& operator = (const DwText& aText);
        virtual void Parse();
        virtual void Assemble();
        virtual DwMessageComponent* Clone() const;
        static DwText* NewText(const DwString& aStr, DwMessageComponent* aParent);
        static DwText* (*sNewText)(const DwString&, DwMessageComponent*);

    public:

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

    protected:

        void _PrintDebugInfo(ostream& aStrm) const;
    };

## DESCRIPTION

`DwText` represents an unstructured field body in a header field. It roughly corresponds to the text element of the BNF grammar defined in RFC-822.

## Public Member Functions

DwText()
DwText(const DwText& aText)
DwText(const DwString& aStr, DwMessageComponent* aParent=0)

The first constructor is the default constructor, which sets the `DwText` 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 from `aText`. The parent of the new `DwText` object is set to NULL.

The third constructor copies `aStr` to the `DwText` 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 DwText& operator = (const DwText& aText)

This is the assignment operator.

virtual void Parse()

This virtual member function is inherited from `DwMessageComponent`, where it is declared a pure virtual function. For a `DwText` object, this member function does nothing, since `DwText` represents an unstructured field body (like the Subject header field) that does not have a broken-down form.

Note, however, that this function should still be called consistently, since a subclass of `DwText` may implement a parse method.

This function clears the is-modified flag.

virtual void Assemble()

This virtual member function is inherited from `DwMessageComponent`, where it is declared a pure virtual function. For a `DwText` object, this member function does nothing, since `DwText` represents an unstructured field body (like the Subject header field) that does not have a broken-down form.

Note, however, that this function should still be called consistently, since a subclass of `DwText` may implement an assemble method.

This function clears the is-modified flag.

virtual DwMessageComponent* Clone() const

This virtual function, inherited from `DwMessageComponent`, creates a new `DwText` on the free store that has the same value as this `DwText` object. The basic idea is that of a ``virtual copy constructor.''

static DwText* NewText(const DwString& aStr, DwMessageComponent* aParent)

Creates a new `DwText` object on the free store. If the static data member `sNewText` is NULL, this member function will create a new `DwText` and return it. Otherwise, `NewText()` will call the user-supplied function pointed to by `sNewText`, which is assumed to return an object from a class derived from `DwText`, and return that object.

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.

## Public Data Members

static DwText* (*sNewText)(const DwString&, DwMessageComponent*)

If `sNewText` is not NULL, it is assumed to point to a user-supplied function that returns an object from a class derived from `DwText`.