SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Protected Member Functions
RWMimeMultipart Class Reference

Represents a MIME part with the media type multipart. More...

#include <rw/mime/RWMimeMultipart.h>

Inheritance diagram for RWMimeMultipart:
RWMimePart RWHandleBase

Public Member Functions

 RWMimeMultipart (void)
 
 RWMimeMultipart (const RWMimeMultipartType &type)
 
 RWMimeMultipart (const RWMimeMultipart &second)
 
 RWMimeMultipart (const RWMimePart &second)
 
virtual ~RWMimeMultipart (void)
 
size_t findPart (const RWMimeHeader &header, size_t start=0) const
 
RWMimePart getPart (size_t position) const
 
size_t getPartCount (void) const
 
RWCString getPreamble (void) const
 
void insertPart (const RWMimePart &part)
 
void insertPartAt (size_t position, const RWMimePart &part)
 
RWMimeMultipartoperator= (const RWMimeMultipart &second)
 
void removePartAt (size_t position)
 
void setPreamble (const RWCString &preamble)
 
- Public Member Functions inherited from RWMimePart
 RWMimePart (void)
 
 RWMimePart (const RWMimeContentType &type)
 
 RWMimePart (const RWMimePart &second)
 
virtual ~RWMimePart (void)
 
RWCString asString (void) const
 
size_t findHeader (const RWCString &label, size_t start=0) const
 
void fromString (const RWCString &partString)
 
RWCString getBody (void) const
 
RWMimeHeader getHeader (size_t position) const
 
size_t getHeaderCount (void) const
 
void insertHeader (const RWMimeHeader &header)
 
void insertHeaderAt (size_t position, const RWMimeHeader &header)
 
bool isMultipart (void) const
 
RWMimePartoperator= (const RWMimePart &second)
 
void removeHeaderAt (size_t position)
 
void setBody (const RWCString &body)
 
- 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

RWMimeMultipartImp & body (void) const
 
- Protected Member Functions inherited from RWMimePart
RWMimePartImp & 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

RWMimeMultipart represents a MIME part with the media type multipart. The MIME multipart media type indicates that the part may contain other MIME parts. An instance of this class contains a vector of RWMimePart objects. The class inherits general functionality from RWMimePart and provides functions for working with the vector of MIME parts.

The MIME specification requires that a multipart part contain a Content-Type header with a multipart media type and a boundary parameter. For example, the simple multipart MIME part:

Content-Type: multipart/mixed; boundary="__the_boundary__"
--__the_boundary__
This is the first part, in plain text.
--__the_boundary__
Content-Type: text/plain; charset=US-ASCII
This is the second part, also in plain text but with a
Content-Type header.
--__the_boundary__--

contains two plain text MIME parts. The value of the boundary parameter delimits each part. Therefore, an RWMimeMultipart object must contain a multipart Content-Type header to be converted to a string.

An instance of this class is a handle to a private, reference-counted body.

Reference
RWMimeMultipart provides an encapsulation of the Multipurpose Internet Mail Extensions (MIME) as described in RFC 2045 - 2049.

Constructor & Destructor Documentation

RWMimeMultipart::RWMimeMultipart ( void  )

Default constructor. Constructs a MIME part with no headers and no body.

Note
A default-constructed RWMimeMultipart does not contain a multipart Content-Type header.
RWMimeMultipart::RWMimeMultipart ( const RWMimeMultipartType type)

Content-Type constructor. Constructs an RWMimeMultipart with a Content-Type header that contains the value type.

RWMimeMultipart::RWMimeMultipart ( const RWMimeMultipart second)

Copy constructor. Constructs a new handle to the body second refers to.

RWMimeMultipart::RWMimeMultipart ( const RWMimePart second)

Conversion constructor. Constructs a new handle to the body second refers to. Throws RWMimeError if second is not a multipart message.

virtual RWMimeMultipart::~RWMimeMultipart ( void  )
virtual

Destructor.

Member Function Documentation

RWMimeMultipartImp& RWMimeMultipart::body ( void  ) const
protected

Returns a reference to the underlying implementation.

size_t RWMimeMultipart::findPart ( const RWMimeHeader header,
size_t  start = 0 
) const

Returns the position of the first part in self's part collection that contains a header matching header. Begins searching at start. If no such part is present, returns RW_NPOS. Compares both the label and value of headers. Uses a case-insensitive string comparison for labels. For values, the comparison is defined by the header type. This function does not search the part collections of any RWMimeMultipart objects contained by self.

RWMimePart RWMimeMultipart::getPart ( size_t  position) const

Retrieve the MIME part located at position. Throws RWBoundsErr if position is greater than or equal to getPartCount().

size_t RWMimeMultipart::getPartCount ( void  ) const

Returns the number of parts self contains.

RWCString RWMimeMultipart::getPreamble ( void  ) const

Returns self's preamble. The RWCString should contain 7-bit US-ASCII data.

void RWMimeMultipart::insertPart ( const RWMimePart part)

Inserts part at the end of self's part collection.

Note
An RWMimeMultipart must not contain itself either directly or indirectly. A part that contains itself cannot be converted to a string.
void RWMimeMultipart::insertPartAt ( size_t  position,
const RWMimePart part 
)

Inserts part into self's part collection at position. Throws RWBoundsErr if position is greater than getPartCount().

Note
An RWMimeMultipart must not contain itself either directly or indirectly. A part that contains itself cannot be converted to a string.
RWMimeMultipart& RWMimeMultipart::operator= ( const RWMimeMultipart second)

Assignment operator. Makes self a handle identical to second.

void RWMimeMultipart::removePartAt ( size_t  position)

Removes the part located at position from self's part collection. Throws RWBoundsErr if position is greater than or equal to getPartCount().

void RWMimeMultipart::setPreamble ( const RWCString preamble)

Sets self's preamble to preamble. The RWCString should contain 7-bit US-ASCII data.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.