VMime
wordEncoder Class Reference

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

enum Encoding

Available encodings for RFC-2047.

Enumerator
ENCODING_AUTO 
ENCODING_QP 
ENCODING_B64 

Constructor & Destructor Documentation

Member Function Documentation

wordEncoder::Encoding getEncoding ( ) const

Return the encoding used.

Returns
encoding
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(), wordEncoder::ENCODING_B64, vmime::lineLengthLimits::max, qpEncoder::RFC2047_getEncodedLength(), and vmime::charsets::UTF_8.

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(), charset::getRecommendedEncoding(), and vmime::encodingTypes::QUOTED_PRINTABLE.

Referenced by wordEncoder::wordEncoder().

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(), charset::getRecommendedEncoding(), and vmime::npos.


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