VMime
bodyPart Class Reference

#include <bodyPart.hpp>

Inheritance diagram for bodyPart:
Collaboration diagram for bodyPart:

Public Member Functions

 bodyPart ()
const shared_ptr< const headergetHeader () const
shared_ptr< headergetHeader ()
void setHeader (shared_ptr< header > header)
const shared_ptr< const bodygetBody () const
shared_ptr< bodygetBody ()
void setBody (shared_ptr< body > body)
bodyPartgetParentPart ()
const bodyPartgetParentPart () const
shared_ptr< componentclone () const
void copyFrom (const component &other)
bodyPartoperator= (const bodyPart &other)
const std::vector< shared_ptr< component > > getChildComponents ()
size_t getGeneratedSize (const generationContext &ctx)
Public Member Functions inherited from component
 component ()
virtual ~component ()
void parse (const string &buffer)
void parse (const parsingContext &ctx, const string &buffer)
void parse (shared_ptr< utility::inputStream > inputStream, const size_t length)
void parse (const string &buffer, const size_t position, const size_t end, size_t *newPosition=NULL)
void parse (const parsingContext &ctx, const string &buffer, const size_t position, const size_t end, size_t *newPosition=NULL)
void parse (shared_ptr< utility::inputStream > inputStream, const size_t position, const size_t end, size_t *newPosition=NULL)
void parse (const parsingContext &ctx, shared_ptr< utility::inputStream > inputStream, const size_t position, const size_t end, size_t *newPosition=NULL)
virtual const string generate (const size_t maxLineLength=lineLengthLimits::infinite, const size_t curLinePos=0) const
virtual void generate (utility::outputStream &outputStream, const size_t curLinePos=0, size_t *newLinePos=NULL) const
virtual void generate (const generationContext &ctx, utility::outputStream &outputStream, const size_t curLinePos=0, size_t *newLinePos=NULL) const
size_t getParsedOffset () const
size_t getParsedLength () const

Protected Member Functions

shared_ptr< bodyPartcreateChildPart ()
void importChildPart (shared_ptr< bodyPart > part)
void parseImpl (const parsingContext &ctx, shared_ptr< utility::parserInputStreamAdapter > parser, const size_t position, const size_t end, size_t *newPosition=NULL)
void generateImpl (const generationContext &ctx, utility::outputStream &os, const size_t curLinePos=0, size_t *newLinePos=NULL) const
Protected Member Functions inherited from component
void setParsedBounds (const size_t start, const size_t end)
virtual void parseImpl (const parsingContext &ctx, const string &buffer, const size_t position, const size_t end, size_t *newPosition=NULL)
Protected Member Functions inherited from object
 object ()
 object (const object &)
objectoperator= (const object &)
virtual ~object ()

Detailed Description

A MIME part.

Constructor & Destructor Documentation

◆ bodyPart()

bodyPart ( )

Member Function Documentation

◆ clone()

shared_ptr< component > clone ( ) const
virtual

Clone this component.

Returns
a copy of this component

Implements component.

Referenced by body.

◆ copyFrom()

void copyFrom ( const component & other)
virtual

Replace data in this component by data in other component.

Both components must be of the same type.

Exceptions
std::bad_cast_exceptionif the components are not of the same (dynamic) type
Parameters
otherother component to copy data from

Implements component.

References bodyPart(), and component::component().

Referenced by body, and operator=().

◆ createChildPart()

shared_ptr< bodyPart > createChildPart ( )
protected

Creates and returns a new part and set this part as its parent.

The newly created sub-part should then be added to this part by calling getBody()->appendPart(). Called by the body class.

Returns
child part

Referenced by body.

◆ generateImpl()

void generateImpl ( const generationContext & ctx,
utility::outputStream & os,
const size_t curLinePos = 0,
size_t * newLinePos = NULL ) const
protectedvirtual

Implements component.

References vmime::CRLF.

Referenced by body.

◆ getBody() [1/2]

shared_ptr< body > getBody ( )

Return the body section of this part.

Returns
body section

◆ getBody() [2/2]

const shared_ptr< const body > getBody ( ) const

Return the body section of this part.

Returns
body section

Referenced by body, messageBuilder::construct(), maildirMessagePart::initStructure(), and maildirMessagePart::maildirMessagePart().

◆ getChildComponents()

const std::vector< shared_ptr< component > > getChildComponents ( )
virtual

Return the list of children of this component.

Returns
list of child components

Implements component.

Referenced by body.

◆ getGeneratedSize()

size_t getGeneratedSize ( const generationContext & ctx)
virtual

Get the number of bytes that will be used by this component when it is generated.

This may be a heuristically-derived estimate, but such an estimated size should always be larger than the actual generated size.

Parameters
ctxgeneration context
Returns
component size when generated

Reimplemented from component.

Referenced by body.

◆ getHeader() [1/2]

shared_ptr< header > getHeader ( )

Return the header section of this part.

Returns
header section

◆ getHeader() [2/2]

const shared_ptr< const header > getHeader ( ) const

Return the header section of this part.

Returns
header section

Referenced by body, messageBuilder::construct(), and maildirMessagePart::maildirMessagePart().

◆ getParentPart() [1/2]

bodyPart * getParentPart ( )

Return the parent part of this part.

Returns
parent part or NULL if not known

References bodyPart().

Referenced by body.

◆ getParentPart() [2/2]

const bodyPart * getParentPart ( ) const

Return the parent part of this part (const version).

Returns
parent part or NULL if not known

References bodyPart().

◆ importChildPart()

void importChildPart ( shared_ptr< bodyPart > part)
protected

Detach the specified part from its current parent part (if any) and attach it to this part by setting this part as its new parent.

The sub-part should then be added to this part by calling getBody()->appendPart(). Called by body class.

Parameters
partchild part to attach

Referenced by body.

◆ operator=()

bodyPart & operator= ( const bodyPart & other)

References bodyPart(), and copyFrom().

Referenced by body.

◆ parseImpl()

void parseImpl ( const parsingContext & ctx,
shared_ptr< utility::parserInputStreamAdapter > parser,
const size_t position,
const size_t end,
size_t * newPosition = NULL )
protectedvirtual

Reimplemented from component.

References vmime::end(), and component::setParsedBounds().

Referenced by body.

◆ setBody()

void setBody ( shared_ptr< body > body)

Replaces the body section of this part.

Parameters
bodynew body section

References bodyPart(), and setBody().

Referenced by body, and setBody().

◆ setHeader()

void setHeader ( shared_ptr< header > header)

Replaces the header section of this part.

Parameters
headerthe new header of this part

Referenced by body.


The documentation for this class was generated from the following files: