Module: Internet Protocols Module Package: MIME
RWMimeContentDispositionRWHandleBase
#include <rw/mime/RWMimeContentDisposition.h>
RWMimeContentDisposition represents the value of a Content-Disposition header of a MIME part. The Content-Disposition specifies the way in which a recipient should present the part.
The value of a Content-Disposition header contains a disposition type and an optional filename parameter. This class provides a convenient interface for creating and working with Content-Disposition values.
An instance of this class is a handle to a private, reference-counted body.
RWMimeContentDisposition conforms to the Content-Disposition header requirements specified in RFC 1806.
RWMimeContentDisposition(void);
Default constructor. Constructs a value with no disposition type and no filename parameter.
NOTE -- A Content-Disposition value with no disposition type does not meet the requirements of RFC 1806.
RWMimeContentDisposition(const RWCString& type, const RWCString& filename="");
Constructs a value with the given disposition type type. If filename is not empty, adds a filename parameter with a value of filename to the new object. The RWCString should contain 7-bit US-ASCII data.
RWMimeContentDisposition(const RWMimeContentDisposition & second);
Copy constructor. Constructs a new handle to the body second refers to.
virtual ~RWMimeContentDisposition(void);
Destructor.
RWMimeContentDisposition& operator=(const RWMimeContentDisposition& second);
Assignment operator. Makes self a handle identical to second.
bool operator==(const RWMimeContentDisposition& first, const RWMimeContentDisposition& second);
Equality operator. Returns true if first is equal to second, false otherwise. The function compares the disposition types using a case-insensitive string comparison. Compares the number of parameters the objects contain, then compares each parameter in each object with the parameter of the same name in the other object. Parameter comparisons use a case-insensitive comparison for parameter name and a case-sensitive comparison for parameter value.
bool operator!=(const RWMimeContentDisposition& first, const RWMimeContentDisposition& second);
Inequality operator. Returns true if first is equal to second, false otherwise. The function compares the disposition types using a case-insensitive string comparison. Compares the number of parameters the objects contain, then compares each parameter in each object with the parameter of the same name in the other object. Parameter comparisons use a case-insensitive comparison for parameter name and a case-sensitive comparison for parameter value.
RWCString asString(void) const;
Returns a string representation of self. The returned string is formatted as specified by RFC 1806 for a Content-Disposition header value. Throws RWMimeError if self cannot be represented as valid MIME. The RWCString should contain 7-bit US-ASCII data.
size_t findParameter(const RWCString& name, size_t start = 0) const;
Returns the index of the first parameter in the collection with a name matching name, or RW_NPOS if no parameter with that name is present. Begins searching at position start. Uses a case-insensitive comparison to match name. The RWCString should contain 7-bit US-ASCII data.
void fromString(const RWCString& dispositionValue);
Populates self from dispositionValue. Throws RWMimeParseError if dispositionValue is not in the format of a Content-Disposition value.
A Content-Disposition value must contain a disposition type, and may contain a filename parameter. So, for example, inline; filename="bluebox.jpg" is a valid dispositionValue. The RWCString should contain 7-bit US-ASCII data.
RWCString getFilename(void) const;
Returns the value of self's filename parameter, or the empty string if no filename parameter is present.
RWMimeParameter getParameter(size_t i) const;
Returns the parameter at the specified position. Throws RWBoundsErr if i is less than 0 or greater than getParameterCount()-1.
size_t getParameterCount(void) const;
Returns the total number of parameters in self.
RWCString getParameterValue(const RWCString& name, size_t start = 0) const;
Returns the value of the first parameter that contains a name matching name, or the empty string if no such parameter is present. Begins searching at start. Matches parameter names using a case-insensitive string comparison to match name. The RWCString should contain 7-bit US-ASCII data.
RWCString getType(void) const;
Returns self's disposition type. The RWCString should contain 7-bit US-ASCII data.
void insertParameter(const RWMimeParameter& parameter);
Inserts parameter at the end of self's parameter list.
void removeAllParameters(void);
Removes all parameters from self.
void removeParameter(size_t position);
Removes the parameter at the specified position. Throws RWBoundsErr if position is less than 0 or greater than getParameterCount()-1.
void setFilename(const RWCString& filename);
Sets the value of self's filename parameter. Does not validate filename.
void setParameterValue(const RWCString& name const RWCString& value, size_t start = 0);
Changes the value of the first parameter that contains a name matching name to value. If no matching parameter exists, creates a new parameter and inserts the new parameter into self's parameter list. Begins searching at start. Matches parameter names using a case-insensitive string comparison. The RWCString should contain 7-bit US-ASCII data.
void setType(const RWCString& type);
Sets self's disposition type. Does not validate type. The RWCString should contain 7-bit US-ASCII data.
RWMimeContentDispositionImp& body(void) const;
Returns a reference to the underlying implementation.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.