VMime
wordEncoder Class Reference

#include <wordEncoder.hpp>

Public Types

enum  Encoding { ENCODING_AUTO , ENCODING_QP , ENCODING_B64 }

Public Member Functions

 wordEncoder (const string &buffer, const charset &charset, const Encoding encoding=ENCODING_AUTO)
const string getNextChunk (const size_t maxLength)
Encoding getEncoding () const

Static Public Member Functions

static bool isEncodingNeeded (const generationContext &ctx, const string &buffer, const charset &charset, const string &lang)
static Encoding guessBestEncoding (const string &buffer, const charset &charset)

Detailed Description

Encodes words following RFC-2047.

Member Enumeration Documentation

◆ Encoding

enum Encoding

Available encodings for RFC-2047.

Enumerator
ENCODING_AUTO 
ENCODING_QP 
ENCODING_B64 

Constructor & Destructor Documentation

◆ wordEncoder()

wordEncoder ( const string & buffer,
const charset & charset,
const Encoding encoding = ENCODING_AUTO )

Member Function Documentation

◆ getEncoding()

wordEncoder::Encoding getEncoding ( ) const

Return the encoding used.

Returns
encoding

◆ getNextChunk()

const string getNextChunk ( const size_t maxLength)

Return the next chunk in the word.

Parameters
maxLengthmaximal length of the chunk
Returns
next chunk, of maximal length 'maxLength' if possible

References charsetConverter::create(), ENCODING_B64, qpEncoder::RFC2047_getEncodedLength(), and vmime::charsets::UTF_8.

◆ guessBestEncoding()

wordEncoder::Encoding guessBestEncoding ( const string & buffer,
const charset & charset )
static

Guess the best RFC-2047 encoding to use for the specified buffer.

Parameters
bufferbuffer to analyze
charsetcharset of the buffer
Returns
RFC-2047 encoding

References stringUtils::countASCIIchars(), ENCODING_B64, ENCODING_QP, charset::getRecommendedEncoding(), and vmime::encodingTypes::QUOTED_PRINTABLE.

Referenced by wordEncoder().

◆ isEncodingNeeded()

bool isEncodingNeeded ( const generationContext & ctx,
const string & buffer,
const charset & charset,
const string & lang )
static

Test whether RFC-2047 encoding is needed.

Parameters
ctxgeneration context
bufferbuffer to analyze
charsetcharset of the buffer
langlanguage code, in the format specified by RFC-1766
Returns
true if encoding is needed, false otherwise.

References stringUtils::findFirstNonASCIIchar(), context::getInternationalizedEmailSupport(), and charset::getRecommendedEncoding().


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