VMime
mediaType Class Reference

#include <mediaType.hpp>

Inheritance diagram for mediaType:
Collaboration diagram for mediaType:

Public Member Functions

 mediaType ()
 mediaType (const string &type)
 mediaType (const string &type, const string &subType)
bool operator== (const mediaType &type) const
bool operator!= (const mediaType &type) const
mediaTypeoperator= (const string &type)
shared_ptr< componentclone () const
void copyFrom (const component &other)
mediaTypeoperator= (const mediaType &other)
const std::vector< shared_ptr< component > > getChildComponents ()
const stringgetType () const
void setType (const string &type)
const stringgetSubType () const
void setSubType (const string &subType)
void setFromString (const string &type)
Public Member Functions inherited from headerFieldValue
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

void parseImpl (const parsingContext &ctx, const string &buffer, 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, shared_ptr< utility::parserInputStreamAdapter > parser, 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 ()

Protected Attributes

string m_type
string m_subType

Detailed Description

Content media type (basic type).

Constructor & Destructor Documentation

◆ mediaType() [1/3]

mediaType ( )

References m_subType, and m_type.

Referenced by copyFrom(), operator!=(), operator=(), operator=(), and operator==().

◆ mediaType() [2/3]

mediaType ( const string & type)

References component::parse().

◆ mediaType() [3/3]

mediaType ( const string & type,
const string & subType )

References m_subType, and m_type.

Member Function Documentation

◆ clone()

shared_ptr< component > clone ( ) const
virtual

Clone this component.

Returns
a copy of this component

Implements component.

References m_subType, and m_type.

◆ 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 m_subType, m_type, and mediaType().

Referenced by operator=().

◆ generateImpl()

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

◆ getChildComponents()

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

Return the list of children of this component.

Returns
list of child components

Implements component.

◆ getSubType()

const string & getSubType ( ) const

Return the media subtype.

See the constants in vmime::mediaTypes.

Returns
media subtype

References m_subType.

Referenced by attachmentHelper::getBodyPartAttachment(), and MDNHelper::isMDN().

◆ getType()

const string & getType ( ) const

Return the media type.

See the constants in vmime::mediaTypes.

Returns
media type

References m_type.

Referenced by attachmentHelper::getBodyPartAttachment(), attachmentHelper::isBodyPartAnAttachment(), MDNHelper::isMDN(), and body::parseImpl().

◆ operator!=()

bool operator!= ( const mediaType & type) const

References mediaType().

◆ operator=() [1/2]

mediaType & operator= ( const mediaType & other)

References copyFrom(), and mediaType().

◆ operator=() [2/2]

mediaType & operator= ( const string & type)

References mediaType(), and component::parse().

◆ operator==()

bool operator== ( const mediaType & type) const

References m_subType, m_type, and mediaType().

◆ parseImpl()

void parseImpl ( const parsingContext & ctx,
const string & buffer,
const size_t position,
const size_t end,
size_t * newPosition = NULL )
protectedvirtual

◆ setFromString()

void setFromString ( const string & type)

Set the media type and subtype from a string in the form "type/subtype" (eg: "image/jpeg").

Parameters
typemedia type and subtype

References component::parse().

◆ setSubType()

void setSubType ( const string & subType)

Set the media subtype.

See the constants in vmime::mediaTypes.

Parameters
subTypemedia subtype

References m_subType, and stringUtils::toLower().

◆ setType()

void setType ( const string & type)

Set the media type.

See the constants in vmime::mediaTypes.

Parameters
typemedia type

References m_type, and stringUtils::toLower().

Member Data Documentation

◆ m_subType

◆ m_type


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