## NAME

DwParameter -- Class representing a MIME field body parameter

## SYNOPSIS

    class DW_EXPORT DwParameter : public DwMessageComponent {

        friend class DwMediaType;

    public:

        DwParameter();
        DwParameter(const DwParameter& aParam);
        DwParameter(const DwString& aStr, DwMessageComponent* aParent=0);
        virtual ~DwParameter();
        const DwParameter& operator = (const DwParameter& aParam);
        virtual void Parse();
        virtual void Assemble();
        virtual DwMessageComponent* Clone() const;
        const DwString& Attribute() const;
        void SetAttribute(const DwString& aAttribute);
        const DwString& Value() const;
        void SetValue(const DwString& aValue);
        DwParameter* Next() const ;
        void SetNext(DwParameter* aParam);
        static DwParameter* NewParameter(const DwString& aStr,
            DwMessageComponent* aParent);
        static DwParameter* (*sNewParameter)(const DwString&, DwMessageComponent*);

    public:

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

    protected:

        void _PrintDebugInfo(ostream& aStrm) const;
    };

## DESCRIPTION

`DwParameter` represents the parameter component of the Content-Type header field as described in RFC-2045. A parameter consists of an attribute/value pair. `DwParameter` has member functions for getting or setting a parameter's attribute and value.

A `DwParameter` object may be included in a list of `DwParameter` objects. You can get the next `DwParameter` object in the list by calling the member function `Next()`.

## Public Member Functions

DwParameter()
DwParameter(const DwParameter& aParam)
DwParameter(const DwString& aStr, DwMessageComponent* aParent=0)

The first constructor is the default constructor, which sets the `DwParameter` 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, attribute, and value from `aParam`. The parent of the new `DwParameter` object is set to NULL.

The third constructor copies `aStr` to the `DwParameter` 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 `DwMediaType`.

const DwParameter& operator = (const DwParameter& aParam)

This is the assignment operator.

virtual void Parse()

This virtual function, inherited from `DwMessageComponent`, executes the parse method for `DwParameter` objects. It should be called immediately after the string representation is modified and before the parts of the broken-down representation are accessed.

virtual void Assemble()

This virtual function, inherited from `DwMessageComponent`, executes the assemble method for `DwParameter` objects. It should be called whenever one of the object's attributes is changed in order to assemble the string representation from its broken-down representation. It will be called automatically for this object by the parent object's `Assemble()` member function if the is-modified flag is set.

virtual DwMessageComponent* Clone() const

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

const DwString& Attribute() const

Returns the attribute contained by this parameter.

void SetAttribute(const DwString& aAttribute)

Sets the attribute contained by this parameter.

const DwString& Value() const

Returns the value contained by this parameter.

void SetValue(const DwString& aValue)

Sets the value contained by this parameter.

DwParameter* Next() const

Returns the next `DwParameter` object in the list.

void SetNext(DwParameter* aParam)

Returns the next `DwParameter` object in the list. Since `DwMediaType` has member functions for adding `DwParameter` objects to its list, you should avoid using this function.

static DwParameter* NewParameter(const DwString& aStr, DwMessageComponent* aParent)

Creates a new `DwParameter` object on the free store. If the static data member `sNewParameter` is NULL, this member function will create a new `DwParameter` and return it. Otherwise, `NewParameter()` will call the user-supplied function pointed to by `sNewParameter`, which is assumed to return an object from a class derived from `DwParameter`, 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 DwParameter* (*sNewParameter)(const DwString&, DwMessageComponent*)

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