SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
Represents the Content-Type
header of a MIME part.
More...
#include <rw/mime/RWMimeContentTypeHeader.h>
Public Member Functions | |
RWMimeContentTypeHeader (void) | |
RWMimeContentTypeHeader (const RWMimeContentType &contentType) | |
RWMimeContentTypeHeader (const RWMimeContentTypeHeader &second) | |
RWMimeContentTypeHeader (const RWMimeHeader &second) | |
RWMimeContentTypeHeader & | operator= (const RWMimeContentTypeHeader &second) |
virtual | ~RWMimeContentTypeHeader (void) |
RWMimeContentType | getContentType (void) const |
void | setContentType (const RWMimeContentType &contentType) |
Static Public Attributes | |
static const RWCString | Label |
Protected Member Functions | |
virtual bool | checkLabel (const RWCString &label) const |
RWMimeContentTypeHeaderImp & | body (void) const |
RWMimeContentTypeHeader represents the Content-Type header of a MIME part. The header specifies the type of data the part contains so that a recipient can process the data correctly. A Content-Type contains two elements, a media type and a subtype. The media type describes the content in broad terms, while the subtype describes the specific content. The two-level hierarchy allows both flexibility and precision.
For example, a plain text email message generally has the content type text/plain
, whereas an HTML document has the content type text/html
, and an XML document has the content type text/xml
. In all three cases, the basic format of the document is text, and the document can be considered text for many purposes (such as deciding whether the document can be usefully opened within a text editor). The subtype indicates the specific format of the text message. While an HTML document can be displayed as plain text, rendering the document in a browser or opening the document in an HTML editor may be more appropriate.
Some content types require other parameters which contain additional information. For example, the MIME specification requires all multipart
content type values to contain a boundary
parameter which specifies the delimiter for message parts. A complete Content-Type header for a multipart/mixed
message
Content-Type: multipart/mixed; boundary=unique-string
has the label Content-Type
and the value multipart/mixed; boundary=unique-string
. The value itself contains the media type multipart
, the subtype mixed
, and a single parameter with the name boundary
and the value unique-string
.
Since the value of a Content-Type header has a complex structure, RWMimeContentType provides a convenient representation of a Content-Type value. See RWMimeContentType for details.
An instance of this class is a handle to a private, reference-counted body.
RWMimeContentTypeHeader conforms to the Content-Type header requirements specified in RFC 2045, Section 5 (p. 10). For details on the content types the MIME specification defines, see RFC 2046.
RWMimeContentTypeHeader::RWMimeContentTypeHeader | ( | void | ) |
Default constructor. Constructs a header with the label "Content-Type"
and an empty value.
RWMimeContentTypeHeader::RWMimeContentTypeHeader | ( | const RWMimeContentType & | contentType | ) |
Constructs a header with the label "Content-Type"
and the value contentType.
RWMimeContentTypeHeader::RWMimeContentTypeHeader | ( | const RWMimeContentTypeHeader & | second | ) |
Copy constructor. Constructs a new handle to the body second refers to.
RWMimeContentTypeHeader::RWMimeContentTypeHeader | ( | const RWMimeHeader & | second | ) |
Conversion constructor. Constructs a new handle to the body second refers to. Throws RWMimeError if second does not have the label "Content-Type"
.
virtual RWMimeContentTypeHeader::~RWMimeContentTypeHeader | ( | void | ) | [virtual] |
Destructor
RWMimeContentTypeHeaderImp& RWMimeContentTypeHeader::body | ( | void | ) | const [protected] |
Returns a reference to the underlying implementation.
Reimplemented from RWMimeHeader.
virtual bool RWMimeContentTypeHeader::checkLabel | ( | const RWCString & | label | ) | const [protected, virtual] |
Returns true
if label matches "Content-Type"
, false
otherwise. The comparison is case-insensitive. The RWCString should contain 7-bit US-ASCII data.
Reimplemented from RWMimeHeader.
RWMimeContentType RWMimeContentTypeHeader::getContentType | ( | void | ) | const |
Returns the value of this header as an RWMimeContentType.
RWMimeContentTypeHeader& RWMimeContentTypeHeader::operator= | ( | const RWMimeContentTypeHeader & | second | ) |
Assignment operator. Makes self a handle identical to second.
void RWMimeContentTypeHeader::setContentType | ( | const RWMimeContentType & | contentType | ) |
Sets the Content-Type this header contains to contentType.
const RWCString RWMimeContentTypeHeader::Label [static] |
Static constant string containing "Content-Type"
, the label for a Content-Type header. The RWCString should contain 7-bit US-ASCII data.
© 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.