SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Static Public Attributes | Protected Member Functions
RWMimeContentTypeHeader Class Reference

Represents the Content-Type header of a MIME part. More...

#include <rw/mime/RWMimeContentTypeHeader.h>

Inheritance diagram for RWMimeContentTypeHeader:
RWMimeHeader RWHandleBase

Public Member Functions

 RWMimeContentTypeHeader (void)
 
 RWMimeContentTypeHeader (const RWMimeContentType &contentType)
 
 RWMimeContentTypeHeader (const RWMimeContentTypeHeader &second)
 
 RWMimeContentTypeHeader (const RWMimeHeader &second)
 
virtual ~RWMimeContentTypeHeader (void)
 
RWMimeContentType getContentType (void) const
 
RWMimeContentTypeHeaderoperator= (const RWMimeContentTypeHeader &second)
 
void setContentType (const RWMimeContentType &contentType)
 
- Public Member Functions inherited from RWMimeHeader
 RWMimeHeader (void)
 
 RWMimeHeader (const RWCString &label)
 
 RWMimeHeader (const RWMimeHeader &second)
 
virtual ~RWMimeHeader (void)
 
RWCString asString (void) const
 
void fromString (const RWCString &headerString)
 
RWCString getLabel (void) const
 
RWMimeHeaderoperator= (const RWMimeHeader &second)
 
- 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
 

Static Public Attributes

static const RWCString Label
 

Protected Member Functions

RWMimeContentTypeHeaderImp & body (void) const
 
virtual bool checkLabel (const RWCString &label) const
 
- Protected Member Functions inherited from RWMimeHeader
RWMimeHeaderImp & body (void) const
 
- Protected Member Functions inherited from RWHandleBase
 RWHandleBase (void)
 
 RWHandleBase (RWStaticCtor)
 
 RWHandleBase (RWBodyBase *body)
 
 RWHandleBase (const RWHandleBase &second)
 
 ~RWHandleBase (void)
 
RWBodyBasebody (void) const
 
RWHandleBaseoperator= (const RWHandleBase &second)
 

Detailed Description

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.

Reference
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.

Constructor & Destructor Documentation

RWMimeContentTypeHeader::RWMimeContentTypeHeader ( void  )

Default constructor. Constructs a header with the label "Content-Type" and an empty value.

Note
A header with an empty value does not meet the requirements for a Content-Type header.
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

Member Function Documentation

RWMimeContentTypeHeaderImp& RWMimeContentTypeHeader::body ( void  ) const
protected

Returns a reference to the underlying implementation.

virtual bool RWMimeContentTypeHeader::checkLabel ( const RWCString label) const
protectedvirtual

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.

Member Data Documentation

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 © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.