VMime
component Class Referenceabstract
Inheritance diagram for component:
Collaboration diagram for component:

Public Member Functions

 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
 
virtual shared_ptr< componentclone () const =0
 
virtual void copyFrom (const component &other)=0
 
size_t getParsedOffset () const
 
size_t getParsedLength () const
 
virtual const std::vector
< shared_ptr< component > > 
getChildComponents ()=0
 
virtual size_t getGeneratedSize (const generationContext &ctx)
 

Protected Member Functions

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

Detailed Description

This abstract class is the base class for all the components of a message.

It defines methods for parsing and generating a component.

Constructor & Destructor Documentation

component ( )
~component ( )
virtual

Member Function Documentation

virtual shared_ptr<component> clone ( ) const
pure virtual
virtual void copyFrom ( const component other)
pure 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

Implemented in header, body, datetime, word, charset, encoding, bodyPart, emailAddress, messageId, parameter, mailbox, path, contentDisposition, headerField, text, parameterizedHeaderField, addressList, mediaType, mailboxGroup, mailboxList, relay, disposition, and messageIdSequence.

const string generate ( const size_t  maxLineLength = lineLengthLimits::infinite,
const size_t  curLinePos = 0 
) const
virtual

Generate RFC-2822/MIME data for this component.

Deprecated:
Use the new generate() method, which takes an outputStream parameter.
Parameters
maxLineLengthmaximum line length for output
curLinePoslength of the current line in the output buffer
Returns
generated data

Reimplemented in message.

References generationContext::getDefaultContext(), and generationContext::setMaxLineLength().

Referenced by textPartFactory::create(), message::generate(), parameter::generateImpl(), mailboxList::generateImpl(), word::generateImpl(), encoding::getEncoder(), headerFieldValue::getGeneratedSize(), SMTPCommand::MAIL(), SMTPCommand::RCPT(), sendmailTransport::send(), and parameter::setValue().

void generate ( utility::outputStream outputStream,
const size_t  curLinePos = 0,
size_t newLinePos = NULL 
) const
virtual

Generate RFC-2822/MIME data for this component, using the default generation context.

Parameters
outputStreamoutput stream
curLinePoslength of the current line in the output buffer
newLinePoswill receive the new line position (length of the last line written)

References generationContext::getDefaultContext().

void generate ( const generationContext ctx,
utility::outputStream outputStream,
const size_t  curLinePos = 0,
size_t newLinePos = NULL 
) const
virtual

Generate RFC-2822/MIME data for this component, using the default generation context.

Parameters
ctxgeneration context
outputStreamoutput stream
curLinePoslength of the current line in the output buffer
newLinePoswill receive the new line position (length of the last line written)
virtual void generateImpl ( const generationContext ctx,
utility::outputStream os,
const size_t  curLinePos = 0,
size_t newLinePos = NULL 
) const
protectedpure virtual
virtual const std::vector<shared_ptr <component> > getChildComponents ( )
pure virtual
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 in header, body, headerField, bodyPart, and headerFieldValue.

References component::getChildComponents().

Referenced by header::getGeneratedSize().

size_t getParsedLength ( ) const

Return the length of this component in the parsed message contents.

Use for debugging only.

Returns
length of the component in parsed buffer or 0 if this component has not been parsed
size_t getParsedOffset ( ) const

Return the start position of this component in the parsed message contents.

Use for debugging only.

Returns
start position in parsed buffer or 0 if this component has not been parsed
void parse ( const parsingContext ctx,
const string buffer 
)

Parse RFC-822/MIME data for this component.

Parameters
ctxparsing context
bufferinput buffer

References component::parseImpl().

void parse ( shared_ptr< utility::inputStream inputStream,
const size_t  length 
)

Parse RFC-822/MIME data for this component.

If stream is not seekable, or if length is not specified, entire contents of the stream will be loaded into memory before parsing.

Parameters
inputStreamstream from which to read data
lengthdata length, in bytes (0 = unknown/not specified)
void parse ( const string buffer,
const size_t  position,
const size_t  end,
size_t newPosition = NULL 
)

Parse RFC-822/MIME data for this component, using the default parsing context.

Parameters
bufferinput buffer
positioncurrent position in the input buffer
endend position in the input buffer
newPositionwill receive the new position in the input buffer

References parsingContext::getDefaultContext().

void parse ( const parsingContext ctx,
const string buffer,
const size_t  position,
const size_t  end,
size_t newPosition = NULL 
)

Parse RFC-822/MIME data for this component.

Parameters
ctxparsing context
bufferinput buffer
positioncurrent position in the input buffer
endend position in the input buffer
newPositionwill receive the new position in the input buffer
void parse ( shared_ptr< utility::inputStream inputStream,
const size_t  position,
const size_t  end,
size_t newPosition = NULL 
)

Parse RFC-822/MIME data for this component.

If stream is not seekable, or if end position is not specified, entire contents of the stream will be loaded into memory before parsing. The default parsing context will be used.

Parameters
inputStreamstream from which to read data
positioncurrent position in the input stream
endend position in the input stream
newPositionwill receive the new position in the input stream

References parsingContext::getDefaultContext().

void parse ( const parsingContext ctx,
shared_ptr< utility::inputStream inputStream,
const size_t  position,
const size_t  end,
size_t newPosition = NULL 
)

Parse RFC-822/MIME data for this component.

If stream is not seekable, or if end position is not specified, entire contents of the stream will be loaded into memory before parsing.

Parameters
ctxparsing context
inputStreamstream from which to read data
positioncurrent position in the input stream
endend position in the input stream
newPositionwill receive the new position in the input stream

References vmime::utility::bufferedStreamCopyRange().

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

Reimplemented in body, and bodyPart.

Referenced by component::parse().

void parseImpl ( const parsingContext ctx,
const string buffer,
const size_t  position,
const size_t  end,
size_t newPosition = NULL 
)
protectedvirtual
void setParsedBounds ( const size_t  start,
const size_t  end 
)
protected

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