VMime
generationContext Class Reference

#include <generationContext.hpp>

Inheritance diagram for generationContext:
Collaboration diagram for generationContext:

Public Types

enum  EncodedParameterValueModes { PARAMETER_VALUE_NO_ENCODING , PARAMETER_VALUE_RFC2047_ONLY , PARAMETER_VALUE_RFC2231_ONLY , PARAMETER_VALUE_RFC2231_AND_RFC2047 }

Public Member Functions

 generationContext ()
 generationContext (const generationContext &ctx)
size_t getMaxLineLength () const
void setMaxLineLength (const size_t maxLineLength)
const string getPrologText () const
void setPrologText (const string &prologText)
const string getEpilogText () const
void setEpilogText (const string &epilogText)
bool getWrapMessageId () const
void setWrapMessageId (const bool &wrapMessageId)
void setEncodedParameterValueMode (const EncodedParameterValueModes mode)
EncodedParameterValueModes getEncodedParameterValueMode () const
generationContextoperator= (const generationContext &ctx)
void copyFrom (const generationContext &ctx)
Public Member Functions inherited from context
virtual ~context ()
bool getInternationalizedEmailSupport () const
void setInternationalizedEmailSupport (const bool support)
const charsetConverterOptionsgetCharsetConversionOptions () const
void setCharsetConversionOptions (const charsetConverterOptions &opts)

Static Public Member Functions

static generationContextgetDefaultContext ()

Protected Attributes

size_t m_maxLineLength
string m_prologText
string m_epilogText
bool m_wrapMessageId
EncodedParameterValueModes m_paramValueMode
Protected Attributes inherited from context
bool m_internationalizedEmail
charsetConverterOptions m_charsetConvOptions

Additional Inherited Members

Protected Member Functions inherited from context
 context ()
 context (const context &ctx)
virtual contextoperator= (const context &ctx)
void copyFrom (const context &ctx)
Protected Member Functions inherited from object
 object ()
 object (const object &)
objectoperator= (const object &)
virtual ~object ()

Detailed Description

Holds configuration parameters used for generating messages.

Member Enumeration Documentation

◆ EncodedParameterValueModes

Modes available for generating values in parameterized header fields.

Enumerator
PARAMETER_VALUE_NO_ENCODING 

Only generate 7-bit (ASCII-only) values, even if the value contains non-ASCII chars or if folding is needed.

PARAMETER_VALUE_RFC2047_ONLY 

Only generate RFC-2047 values (do not use RFC-2231).

This is non-standard but most mail clients support it.

PARAMETER_VALUE_RFC2231_ONLY 

Only generate RFC-2231 values (do not use RFC-2047).

Some mail clients may not support it. This is the default.

PARAMETER_VALUE_RFC2231_AND_RFC2047 

Generate both RFC-2047- and RFC-2231-encoded values.

Constructor & Destructor Documentation

◆ generationContext() [1/2]

◆ generationContext() [2/2]

generationContext ( const generationContext & ctx)

Member Function Documentation

◆ copyFrom()

◆ getDefaultContext()

generationContext & getDefaultContext ( )
static

Returns the default context used for generating messages.

Returns
a reference to the default generation context

References generationContext().

Referenced by component::generate(), component::generate(), SMTPTransport::send(), and emailAddress::toString().

◆ getEncodedParameterValueMode()

generationContext::EncodedParameterValueModes getEncodedParameterValueMode ( ) const

Returns the mode used for generating parameter values in a parameterized header field (see parameterizedHeaderField class).

Returns
parameter value generation mode

References m_paramValueMode.

Referenced by parameter::generateImpl().

◆ getEpilogText()

const string getEpilogText ( ) const

Returns the current epilog text used when generating MIME body parts.

Returns
current MIME epilog text

References m_epilogText.

◆ getMaxLineLength()

size_t getMaxLineLength ( ) const

◆ getPrologText()

const string getPrologText ( ) const

Returns the current prolog text used when generating MIME body parts.

Returns
current MIME prolog text

References m_prologText.

◆ getWrapMessageId()

bool getWrapMessageId ( ) const

Returns a boolean variable that indicates whether the message id can be wrapped or not, i.e.

from

Message-Id: <very very long@domain>

to

Message-Id:
 <very very long@domain>
Returns
boolean indicating if the Message-Id can be wrapped

References m_wrapMessageId.

Referenced by messageId::generateImpl().

◆ operator=()

generationContext & operator= ( const generationContext & ctx)

References copyFrom(), and generationContext().

◆ setEncodedParameterValueMode()

void setEncodedParameterValueMode ( const EncodedParameterValueModes mode)

Sets the mode used for generating parameter values in a parameterized header field (see parameterizedHeaderField class).

PARAMETER_VALUE_NO_ENCODING or PARAMETER_VALUE_RFC2047_ONLY can be used for compatibility with implementations that do not understand RFC-2231, to generate a normal parameter value. PARAMETER_VALUE_RFC2047_ONLY is non-standard (and expressly prohibited by the RFC) but most mail clients support it.

Notice: if both the normal value and the extended value are present, the latter can be ignored by mail processing systems. This may lead to annoying problems, for example, with strange names of attachments with all but 7-bit ascii characters removed, etc. Either PARAMETER_VALUE_RFC2231_ONLY or PARAMETER_VALUE_RFC2047_ONLY should be preferred over PARAMETER_VALUE_RFC2231_AND_RFC2047, not to create a normal value if the extended value is to be generated.

Parameters
modeparameter value generation mode

References m_paramValueMode.

◆ setEpilogText()

void setEpilogText ( const string & epilogText)

Sets the epilog text used when generating MIME body parts.

This test appears after the part, and should be displayed by MUAs which do not support MIME. This should be 7-bit ASCII text only.

References m_epilogText.

◆ setMaxLineLength()

void setMaxLineLength ( const size_t maxLineLength)

Sets the maximum line length used when generating messages.

You may use the constants lineLengthLimits::convenient, lineLengthLimits::max and lineLengthLimits::infinite.

Parameters
maxLineLengthnew maximum line length, in bytes

References m_maxLineLength.

Referenced by component::generate(), addressList::generateImpl(), mailboxGroup::generateImpl(), messageIdSequence::generateImpl(), and emailAddress::toString().

◆ setPrologText()

void setPrologText ( const string & prologText)

Sets the prolog text used when generating MIME body parts.

This text appears before the part, and should be displayed by MUAs which do not support MIME. This should be 7-bit ASCII text only.

Parameters
prologTextMIME prolog text

References m_prologText.

◆ setWrapMessageId()

void setWrapMessageId ( const bool & wrapMessageId)

Sets the boolean variable that indicates whether the Message-Id can be wrapped or not.

References m_wrapMessageId.

Member Data Documentation

◆ m_epilogText

◆ m_maxLineLength

◆ m_paramValueMode

◆ m_prologText

◆ m_wrapMessageId

bool m_wrapMessageId
protected

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