Represents the value of a Content-Disposition header of a MIME part. More...
#include <rw/mime/RWMimeContentDisposition.h>
Public Member Functions | |
RWMimeContentDisposition (void) | |
RWMimeContentDisposition (const RWCString &type, const RWCString &filename="") | |
RWMimeContentDisposition (const RWMimeContentDisposition &second) | |
virtual | ~RWMimeContentDisposition (void) |
RWCString | asString (void) const |
size_t | findParameter (const RWCString &name, size_t start=0) const |
void | fromString (const RWCString &dispositionValue) |
RWCString | getFilename (void) const |
RWMimeParameter | getParameter (size_t i) const |
size_t | getParameterCount (void) const |
RWCString | getParameterValue (const RWCString &name, size_t start=0) const |
RWCString | getType (void) const |
void | insertParameter (const RWMimeParameter ¶meter) |
RWMimeContentDisposition & | operator= (const RWMimeContentDisposition &second) |
void | removeAllParameters (void) |
void | removeParameter (size_t position) |
void | setFilename (const RWCString &filename) |
void | setParameterValue (const RWCString &name, const RWCString &value, size_t start=0) |
void | setType (const RWCString &type) |
Public Member Functions inherited from RWHandleBase | |
bool | isValid (void) const |
bool | operator!= (const RWHandleBase &second) const |
bool | operator< (const RWHandleBase &second) const |
bool | operator== (const RWHandleBase &second) const |
Protected Member Functions | |
RWMimeContentDispositionImp & | body (void) const |
Protected Member Functions inherited from RWHandleBase | |
RWHandleBase (void) | |
RWHandleBase (RWStaticCtor) | |
RWHandleBase (RWBodyBase *body) | |
RWHandleBase (const RWHandleBase &second) | |
~RWHandleBase (void) | |
RWBodyBase & | body (void) const |
RWHandleBase & | operator= (const RWHandleBase &second) |
Friends | |
bool | operator!= (const RWMimeContentDisposition &first, const RWMimeContentDisposition &second) |
bool | operator== (const RWMimeContentDisposition &first, const RWMimeContentDisposition &second) |
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::RWMimeContentDisposition | ( | void | ) |
Default constructor. Constructs a value with no disposition type and no filename parameter.
RWMimeContentDisposition::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::RWMimeContentDisposition | ( | const RWMimeContentDisposition & | second | ) |
Copy constructor. Constructs a new handle to the body second refers to.
|
virtual |
Destructor.
RWCString RWMimeContentDisposition::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.
|
protected |
Returns a reference to the underlying implementation.
size_t RWMimeContentDisposition::findParameter | ( | const RWCString & | name, |
size_t | start = 0 |
||
) | const |
void RWMimeContentDisposition::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 RWMimeContentDisposition::getFilename | ( | void | ) | const |
Returns the value of self's filename parameter, or the empty string if no filename parameter is present.
RWMimeParameter RWMimeContentDisposition::getParameter | ( | size_t | i | ) | const |
Returns the parameter at the specified position. Throws RWBoundsErr if i is greater than or equal to getParameterCount().
size_t RWMimeContentDisposition::getParameterCount | ( | void | ) | const |
Returns the total number of parameters in self.
RWCString RWMimeContentDisposition::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 RWMimeContentDisposition::getType | ( | void | ) | const |
Returns self's disposition type. The RWCString should contain 7-bit US-ASCII data.
void RWMimeContentDisposition::insertParameter | ( | const RWMimeParameter & | parameter | ) |
Inserts parameter at the end of self's parameter list.
RWMimeContentDisposition& RWMimeContentDisposition::operator= | ( | const RWMimeContentDisposition & | second | ) |
Assignment operator. Makes self a handle identical to second.
void RWMimeContentDisposition::removeAllParameters | ( | void | ) |
Removes all parameters from self.
void RWMimeContentDisposition::removeParameter | ( | size_t | position | ) |
Removes the parameter at the specified position. Throws RWBoundsErr if position is greater than or equal to getParameterCount().
void RWMimeContentDisposition::setFilename | ( | const RWCString & | filename | ) |
Sets the value of self's filename parameter. Does not validate filename.
void RWMimeContentDisposition::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 RWMimeContentDisposition::setType | ( | const RWCString & | type | ) |
Sets self's disposition type. Does not validate type. The RWCString should contain 7-bit US-ASCII data.
|
friend |
Inequality operator. Returns true
if first is not equal to second, false
otherwise. The function compares the disposition types using a case-insensitive string comparison. Compares the number of parameters each object contains then compares each parameter in each object to 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.
|
friend |
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 each object contains then compares each parameter in each object to 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.
Copyright © 2021 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |