VMime
word Class Reference

#include <word.hpp>

Inheritance diagram for word:
Collaboration diagram for word:

Public Member Functions

 word ()
 word (const word &w)
 word (const string &buffer)
 word (const string &buffer, const charset &charset)
 word (const string &buffer, const charset &charset, const string &lang)
const stringgetBuffer () const
stringgetBuffer ()
bool isEmpty () const
void setBuffer (const string &buffer)
const charsetgetCharset () const
void setCharset (const charset &ch)
const string getLanguage () const
void setLanguage (const string &lang)
bool isEquivalent (const word &other) const
wordoperator= (const word &w)
wordoperator= (const string &s)
bool operator== (const word &w) const
bool operator!= (const word &w) const
const string getConvertedText (const charset &dest, const charsetConverterOptions &opts=charsetConverterOptions()) const
void copyFrom (const component &other)
shared_ptr< componentclone () const
const std::vector< shared_ptr< component > > getChildComponents ()
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
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)
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
void parseWithState (const parsingContext &ctx, const string &buffer, const size_t position, const size_t end, size_t *newPosition, parserState *state)
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 ()

Detailed Description

A class that encapsulates an encoded-word (RFC-2047): some text encoded into one specified charset.

Constructor & Destructor Documentation

◆ word() [1/5]

word ( )

Construct an empty word.

Charset is set to the current locale charset.

Referenced by copyFrom(), isEquivalent(), operator!=(), operator=(), operator=(), operator==(), text, and word().

◆ word() [2/5]

word ( const word & w)

Construct a word by copying another word.

References word().

◆ word() [3/5]

word ( const string & buffer)
explicit

Construct a word using a string buffer.

Charset is set to the current locale charset.

◆ word() [4/5]

word ( const string & buffer,
const charset & charset )

Construct a word using a string buffer and a specified charset.

Parameters
bufferstring buffer
charsetcharset in which the string is encoded

◆ word() [5/5]

word ( const string & buffer,
const charset & charset,
const string & lang )

Construct a word using a string buffer and a specified charset and language tag (RFC-1766).

Parameters
bufferstring buffer
charsetcharset in which the string is encoded
langlanguage tag, in the format specified by RFC-1766

Member Function Documentation

◆ clone()

shared_ptr< component > clone ( ) const
virtual

Clone this word.

Returns
a copy of this word

Implements component.

Referenced by text.

◆ copyFrom()

void copyFrom ( const component & other)
virtual

Replace data in this word by data in other word.

Parameters
otherother word to copy data from

Implements component.

References word().

Referenced by text.

◆ generate() [1/3]

void generate ( const generationContext & ctx,
utility::outputStream & outputStream,
const size_t curLinePos = 0,
size_t * newLinePos = NULL ) const
virtual

Generate RFC-2822/MIME data for this component, using the default generation context.

Parameters
ctxgeneration context
outputStreamoutput stream
curLinePoslength of the current line in the output buffer
newLinePoswill receive the new line position (length of the last line written)

Reimplemented from component.

◆ generate() [2/3]

const string generate ( const size_t maxLineLength = lineLengthLimits::infinite,
const size_t curLinePos = 0 ) const
virtual

Generate RFC-2822/MIME data for this component.

Deprecated
Use the new generate() method, which takes an outputStream parameter.
Parameters
maxLineLengthmaximum line length for output
curLinePoslength of the current line in the output buffer
Returns
generated data

Reimplemented from component.

Referenced by emailAddress::generateImpl(), and generateImpl().

◆ generate() [3/3]

void generate ( utility::outputStream & outputStream,
const size_t curLinePos = 0,
size_t * newLinePos = NULL ) const
virtual

Generate RFC-2822/MIME data for this component, using the default generation context.

Parameters
outputStreamoutput stream
curLinePoslength of the current line in the output buffer
newLinePoswill receive the new line position (length of the last line written)

Reimplemented from component.

◆ generateImpl()

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

Implements component.

References generate().

◆ getBuffer() [1/2]

string & getBuffer ( )

Return the raw data for this encoded word.

Returns
raw data buffer

◆ getBuffer() [2/2]

const string & getBuffer ( ) const

◆ getCharset()

const charset & getCharset ( ) const

Return the charset of this word.

Returns
charset for this word

Referenced by text.

◆ getChildComponents()

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

Return the list of children of this component.

Returns
list of child components

Implements component.

◆ getConvertedText()

const string getConvertedText ( const charset & dest,
const charsetConverterOptions & opts = charsetConverterOptions() ) const

Return the contained text converted to the specified charset.

Parameters
destoutput charset
optsoptions for charset conversion
Returns
word converted to the specified charset

References charset::convert().

Referenced by isEquivalent(), and text.

◆ getLanguage()

const string getLanguage ( ) const

Return the language used in this word (optional).

If not specified, the value is empty.

Returns
language tag for this word, in the format specified by RFC-1766

Referenced by text.

◆ isEmpty()

bool isEmpty ( ) const

Tests whether this word is empty.

Returns
true if the buffer is empty, false otherwise

Referenced by fileAttachment::fileAttachment(), fileAttachment::fileAttachment(), fileAttachment::fileAttachment(), and text.

◆ isEquivalent()

bool isEquivalent ( const word & other) const

Returns whether two words actually represent the same text, regardless of their charset.

Parameters
otherword to compare to
Returns
true if the two words represent the same text, or false otherwise

References getConvertedText(), vmime::charsets::UTF_8, and word().

Referenced by text.

◆ operator!=()

bool operator!= ( const word & w) const

References word().

Referenced by text.

◆ operator=() [1/2]

word & operator= ( const string & s)

◆ operator=() [2/2]

word & operator= ( const word & w)

References word().

Referenced by text.

◆ operator==()

bool operator== ( const word & w) const

References word().

Referenced by text.

◆ parseImpl()

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

Reimplemented from component.

References vmime::end(), and parseWithState().

◆ parseWithState()

void parseWithState ( const parsingContext & ctx,
const string & buffer,
const size_t position,
const size_t end,
size_t * newPosition,
parserState * state )
protected

◆ setBuffer()

void setBuffer ( const string & buffer)

Set the raw data for this encoded word.

Parameters
bufferraw data buffer

Referenced by kmailMaildirFormat::folderPathToFileSystemPath(), parameter::parseImpl(), and text.

◆ setCharset()

void setCharset ( const charset & ch)

Set the charset of this word.

Parameters
chcharset of this word

Referenced by text.

◆ setLanguage()

void setLanguage ( const string & lang)

Set the language used in this word (optional).

Parameters
langlanguage tag, in the format specified by RFC-1766

Referenced by text.


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