class DW_CORE_EXPORT DwDispositionType : public DwFieldBody { public: DwDispositionType(); DwDispositionType(const DwDispositionType& aDispType); DwDispositionType(const DwString& aStr, DwMessageComponent* aParent=0); virtual ~DwDispositionType(); const DwDispositionType& operator = (const DwDispositionType& aDispType); virtual void Parse(); virtual void Assemble(); virtual DwMessageComponent* Clone() const; int DispositionType() const; void SetDispositionType(int aType); const DwString& DispositionTypeStr() const; void SetDispositionTypeStr(const DwString& aStr); const DwString& Filename() const; void SetFilename(const DwString& aStr); int NumParameters() const; void AddParameter(DwParameter* aParam); void DeleteAllParameters(); DwParameter& ParameterAt(int aIndex) const; void InsertParameterAt(int aIndex, DwParameter* aParam); DwParameter* RemoveParameterAt(int aIndex); static DwDispositionType* NewDispositionType(const DwString& aStr, DwMessageComponent* aParent); static DwDispositionType* (*sNewDispositionType)(const DwString&, DwMessageComponent*); protected: int mDispositionType; DwString mDispositionTypeStr; DwString mFilenameStr; virtual void EnumToStr(); virtual void StrToEnum(); void _CopyParameters(const DwDispositionType& aType); void _InsertParameterAt(int aIndex, DwParameter* aParam); void _DeleteAllParameters(); public: virtual void PrintDebugInfo(DW_STD ostream& aStrm, int aDepth=0) const; virtual void CheckInvariants() const; protected: void _PrintDebugInfo(DW_STD ostream& aStrm) const; };
DwDispositionType provides convenience functions that allow you to set or get the disposition-type as an enumerated value, to set or get the filename parameter, or to manage a list of parameters.
RFC-1806 specifically states that the Content-Disposition header field is experimental and not a proposed standard.
The first constructor is the default constructor, which sets the DwDispositionType object's string representation to the empty string and sets its parent to NULL.
The second constructor is the copy constructor, which performs deep copy of aDispType. The parent of the new DwDispositionType object is set to NULL.
The third constructor copies aStr to the DwDispositionType 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 DwDispositionType& operator = (const DwDispositionType& aDispType)
This is the assignment operator, which performs a deep copy of aDispType. The parent node of the DwDipositionType object is not changed.
virtual void Parse()
This virtual function, inherited from DwMessageComponent, executes the parse method for DwDispositionType objects. It should be called immediately after the string representation is modified and before the parts of the broken-down representation are accessed.
This function clears the is-modified flag.
virtual void Assemble()
This virtual function, inherited from DwMessageComponent, executes the assemble method for DwDispositionType 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.
This function clears the is-modified flag.
virtual DwMessageComponent* Clone() const
This virtual function, inherited from DwMessageComponent, creates a new DwDispositionType object on the free store that has the same value as this DwDispositionType object. The basic idea is that of a virtual copy constructor.
int DispositionType() const
Returns the disposition-type as an enumerated value. Valid enumerated types, which are defined in enum.h, include DwMime::kDispTypeNull, DwMime::kDispTypeUnknown, DwMime::kDispTypeInline, and DwMime::kDispTypeAttachment.
void SetDispositionType(int aType)
Sets the disposition-type from the enumerated value aType. Valid enumerated types, which are defined in enum.h, include DwMime::kDispTypeNull, DwMime::kDispTypeUnknown, DwMime::kDispTypeInline, and DwMime::kDispTypeAttachment.
const DwString& DispositionTypeStr() const
Returns the disposition-type as a string.
void SetDispositionTypeStr(const DwString& aStr)
Sets the disposition-type from a string.
const DwString& Filename() const
This convenience function returns the value from the filename parameter, if present. If no filename parameter is present, an empty string is returned.
void SetFilename(const DwString& aStr)
This convenience function sets the value of the filename parameter to aStr.
int NumParameters() const
Returns the number of DwParameter objects contained in this DwDispositionType object.
void AddParameter(DwParameter* aParam)
Appends a DwParameter object to the list managed by this DwDispositionType object.
Any DwParameter objects contained in a DwDispositionType object's list will be deleted by the DwDispositionType object's destructor.
void DeleteAllParameters()
Removes and deletes all DwParameter objects contained in this DwDispositionType object.
DwParameter& ParameterAt(int aIndex) const
Returns the DwParameter object at position aIndex in this DwDispositionType object's list.
If the library is compiled to throw exceptions, the function will throw a DwBoundsException if aIndex is out of range. Otherwise, (if the library is compiled not to throw exceptions) the behavior is undefined if aIndex is out of range. Valid values for aIndex are 0 <= aIndex < NumParameters().
void InsertParameterAt(int aIndex, DwParameter* aParam)
Inserts aParam into the list of DwParameter objects at the position given by aIndex. A value of zero for aIndex will insert aParam as the first one in the list; a value of NumParameters() will insert it as the last one in the list. If aIndex is less than NumParameters(), the DwParameter objects at position aIndex or greater will be shifted down the list to make room to insert aParam.
Any DwParameter objects contained in a DwDispositionType object's list will be deleted by the DwDispositionType object's destructor.
If the library is compiled to throw exceptions, the function will throw a DwBoundsException if aIndex is out of range. Otherwise, (if the library is compiled not to throw exceptions) the behavior is undefined if aIndex is out of range. Valid values for aIndex are 0 <= aIndex <= NumParameters().
DwParameter* RemoveParameterAt(int aIndex)
Removes the DwParameter object at position aIndex from the list and returns it. If aIndex is less than NumParameters()-1, then any DwParameter objects at a position greater than aIndex will be shifted up in the list after the requested DwParameter is removed.
If the library is compiled to throw exceptions, the function will throw a DwBoundsException if aIndex is out of range. Otherwise, (if the library is compiled not to throw exceptions) the behavior is undefined if aIndex is out of range. Valid values for aIndex are 0 <= aIndex < Numparameters().
static DwDispositionType* NewDispositionType(const DwString& aStr, DwMessageComponent* aParent)
Creates a new DwDispositionType object on the free store. If the static data member sNewDispositionType is NULL, this member function will create a new DwDispositionType and return it. Otherwise, NewDispositionType() will call the user-supplied function pointed to by sNewDispositionType, which is assumed to return an object from a class derived from DwDispositionType , and return that object.
If sNewDispositionType is not NULL, it is assumed to point to a user-supplied function that returns an object from a class derived from DwDispositionType.
Copies the list of DwParameter objects from aType.
void _InsertParameterAt(int aIndex, DwParameter* aParam)
Performs all the work of adding DwParameter objects to the list. This function does not set the is-modified flag.
void _DeleteAllParameters()
Deletes all parameters. Differs from DeleteAllParameters() in that it does not set the is-modified flag.