VMime
contentHandler Class Referenceabstract

#include <contentHandler.hpp>

Inheritance diagram for contentHandler:
Collaboration diagram for contentHandler:

Public Member Functions

virtual ~contentHandler ()
virtual shared_ptr< contentHandlerclone () const =0
virtual void generate (utility::outputStream &os, const vmime::encoding &enc, const size_t maxLineLength=lineLengthLimits::infinite) const =0
virtual void extract (utility::outputStream &os, utility::progressListener *progress=NULL) const =0
virtual void extractRaw (utility::outputStream &os, utility::progressListener *progress=NULL) const =0
virtual size_t getLength () const =0
virtual bool isEncoded () const =0
virtual const vmime::encodinggetEncoding () const =0
virtual bool isEmpty () const =0
virtual bool isBuffered () const =0
virtual void setContentTypeHint (const mediaType &type)=0
virtual const mediaType getContentTypeHint () const =0

Static Public Attributes

static const vmime::encoding NO_ENCODING

Additional Inherited Members

Protected Member Functions inherited from object
 object ()
 object (const object &)
objectoperator= (const object &)
virtual ~object ()

Constructor & Destructor Documentation

◆ ~contentHandler()

~contentHandler ( )
virtual

Member Function Documentation

◆ clone()

virtual shared_ptr< contentHandler > clone ( ) const
pure virtual

Return a copy of this object.

Returns
copy of this object

Implemented in emptyContentHandler, fileContentHandler, IMAPMessagePartContentHandler, streamContentHandler, and stringContentHandler.

◆ extract()

virtual void extract ( utility::outputStream & os,
utility::progressListener * progress = NULL ) const
pure virtual

Extract the contents into the specified stream.

If needed, data will be decoded before being written into the stream.

Exceptions
exceptions::no_encoder_availableif the encoding is not supported
Parameters
osoutput stream
progressprogress listener, or NULL if you do not want to receive progress notifications

Implemented in emptyContentHandler, IMAPMessagePartContentHandler, streamContentHandler, and stringContentHandler.

◆ extractRaw()

virtual void extractRaw ( utility::outputStream & os,
utility::progressListener * progress = NULL ) const
pure virtual

Extract the contents into the specified stream, without decoding it.

It may be useful in case the encoding is not supported and you want to extract raw data.

Parameters
osoutput stream
progressprogress listener, or NULL if you do not want to receive progress notifications

Implemented in emptyContentHandler, IMAPMessagePartContentHandler, streamContentHandler, and stringContentHandler.

◆ generate()

virtual void generate ( utility::outputStream & os,
const vmime::encoding & enc,
const size_t maxLineLength = lineLengthLimits::infinite ) const
pure virtual

Output the contents into the specified stream.

Data will be encoded before being written into the stream. This is used internally by the body object to generate the message, you may not need to use this (see contentHandler::extract() if you want to get the contents).

Parameters
osoutput stream
encencoding for output
maxLineLengthmaximum line length for output

Implemented in emptyContentHandler, IMAPMessagePartContentHandler, streamContentHandler, and stringContentHandler.

References vmime::lineLengthLimits::infinite.

◆ getContentTypeHint()

virtual const mediaType getContentTypeHint ( ) const
pure virtual

Returns a hint about the kind of data managed by this object.

Returns
type content media type

Implemented in emptyContentHandler, IMAPMessagePartContentHandler, streamContentHandler, and stringContentHandler.

◆ getEncoding()

virtual const vmime::encoding & getEncoding ( ) const
pure virtual

Returns the encoding used for data (or "binary" if not encoded).

Returns
encoding used for data

Implemented in emptyContentHandler, IMAPMessagePartContentHandler, streamContentHandler, and stringContentHandler.

◆ getLength()

virtual size_t getLength ( ) const
pure virtual

Returns the actual length of data.

WARNING: this can return 0 if no length was specified when setting data of this object, or if the length is not known).

Returns
length of data

Implemented in emptyContentHandler, IMAPMessagePartContentHandler, streamContentHandler, and stringContentHandler.

◆ isBuffered()

virtual bool isBuffered ( ) const
pure virtual

Indicates whether the extract() method can be called multiple times.

Returns
true if the data can be extracted multiple times, or false if not (ie. streamed data from socket)

Implemented in emptyContentHandler, IMAPMessagePartContentHandler, streamContentHandler, and stringContentHandler.

◆ isEmpty()

virtual bool isEmpty ( ) const
pure virtual

Returns 'true' if there is no data set.

Returns
true if no data is managed by this object, false otherwise

Implemented in emptyContentHandler, IMAPMessagePartContentHandler, streamContentHandler, and stringContentHandler.

◆ isEncoded()

virtual bool isEncoded ( ) const
pure virtual

Returns 'true' if data managed by this object is encoded.

Returns
true if data is encoded, false otherwise

Implemented in emptyContentHandler, IMAPMessagePartContentHandler, streamContentHandler, and stringContentHandler.

◆ setContentTypeHint()

virtual void setContentTypeHint ( const mediaType & type)
pure virtual

Gives a hint about the kind of data managed by this object.

Parameters
typecontent media type

Implemented in emptyContentHandler, IMAPMessagePartContentHandler, streamContentHandler, and stringContentHandler.

Member Data Documentation

◆ NO_ENCODING


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