VMime
emailAddress Class Reference

#include <emailAddress.hpp>

Inheritance diagram for emailAddress:
Collaboration diagram for emailAddress:

Public Member Functions

 emailAddress ()
 emailAddress (const emailAddress &eml)
 emailAddress (const string &email)
 emailAddress (const char *email)
 emailAddress (const string &localName, const string &domainName)
 emailAddress (const word &localName, const word &domainName)
const wordgetLocalName () const
void setLocalName (const word &localName)
const wordgetDomainName () const
void setDomainName (const word &domainName)
bool isEmpty () const
const string toString () const
const text toText () const
bool operator== (const class emailAddress &eml) const
bool operator!= (const class emailAddress &eml) const
void copyFrom (const component &other)
shared_ptr< componentclone () const
emailAddressoperator= (const emailAddress &other)
const std::vector< shared_ptr< component > > getChildComponents ()
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 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
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
virtual size_t getGeneratedSize (const generationContext &ctx)

Protected Attributes

word m_localName
word m_domainName

Additional Inherited Members

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

An email address: local name and domain name (basic type).

Constructor & Destructor Documentation

◆ emailAddress() [1/6]

emailAddress ( )

◆ emailAddress() [2/6]

emailAddress ( const emailAddress & eml)

◆ emailAddress() [3/6]

emailAddress ( const string & email)

References parse().

◆ emailAddress() [4/6]

emailAddress ( const char * email)

References parse().

◆ emailAddress() [5/6]

emailAddress ( const string & localName,
const string & domainName )

◆ emailAddress() [6/6]

emailAddress ( const word & localName,
const word & domainName )

Member Function Documentation

◆ clone()

shared_ptr< component > clone ( ) const
virtual

Clone this component.

Returns
a copy of this component

Implements component.

◆ 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 component::component(), emailAddress(), m_domainName, and m_localName.

Referenced by operator=().

◆ 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.

References vmime::end(), and component::parseImpl().

◆ 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 SMTPCommand::MAIL(), SMTPCommand::RCPT(), and sendmailTransport::send().

◆ 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
virtual

◆ getChildComponents()

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

Return the list of children of this component.

Returns
list of child components

Implements component.

◆ getDomainName()

const word & getDomainName ( ) const

Return the domain name of the address.

Returns
domain name of the address

References m_domainName.

◆ getLocalName()

const word & getLocalName ( ) const

Return the local name of the address.

Returns
local name of the address

References m_localName.

◆ isEmpty()

bool isEmpty ( ) const

Returns whether this email address is empty.

Address is considered as empty if the local part is not specified.

Returns
true if the address is empty, false otherwise

References m_localName.

◆ operator!=()

bool operator!= ( const class emailAddress & eml) const

References emailAddress().

◆ operator=()

emailAddress & operator= ( const emailAddress & other)

References copyFrom(), and emailAddress().

◆ operator==()

bool operator== ( const class emailAddress & eml) const

◆ parse() [1/7]

void parse ( const parsingContext & ctx,
const string & buffer )

Parse RFC-822/MIME data for this component.

Parameters
ctxparsing context
bufferinput buffer

◆ parse() [2/7]

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

Parse RFC-822/MIME data for this component.

Parameters
ctxparsing context
bufferinput buffer
positioncurrent position in the input buffer
endend position in the input buffer
newPositionwill receive the new position in the input buffer

References parsingContext::getDefaultContext().

◆ parse() [3/7]

void parse ( const parsingContext & ctx,
shared_ptr< utility::inputStream > inputStream,
const size_t position,
const size_t end,
size_t * newPosition = NULL )

Parse RFC-822/MIME data for this component.

If stream is not seekable, or if end position is not specified, entire contents of the stream will be loaded into memory before parsing.

Parameters
ctxparsing context
inputStreamstream from which to read data
positioncurrent position in the input stream
endend position in the input stream
newPositionwill receive the new position in the input stream

References component::getChildComponents().

◆ parse() [4/7]

void parse ( const string & buffer)

Parse RFC-822/MIME data for this component, using the default parsing context.

Parameters
bufferinput buffer

References vmime::end(), parsingContext::getDefaultContext(), and parse().

Referenced by emailAddress(), emailAddress(), and parse().

◆ parse() [5/7]

void parse ( const string & buffer,
const size_t position,
const size_t end,
size_t * newPosition = NULL )

Parse RFC-822/MIME data for this component, using the default parsing context.

Parameters
bufferinput buffer
positioncurrent position in the input buffer
endend position in the input buffer
newPositionwill receive the new position in the input buffer

◆ parse() [6/7]

void parse ( shared_ptr< utility::inputStream > inputStream,
const size_t length )

Parse RFC-822/MIME data for this component.

If stream is not seekable, or if length is not specified, entire contents of the stream will be loaded into memory before parsing.

Parameters
inputStreamstream from which to read data
lengthdata length, in bytes (0 = unknown/not specified)

References vmime::utility::bufferedStreamCopyRange(), and vmime::end().

◆ parse() [7/7]

void parse ( shared_ptr< utility::inputStream > inputStream,
const size_t position,
const size_t end,
size_t * newPosition = NULL )

Parse RFC-822/MIME data for this component.

If stream is not seekable, or if end position is not specified, entire contents of the stream will be loaded into memory before parsing. The default parsing context will be used.

Parameters
inputStreamstream from which to read data
positioncurrent position in the input stream
endend position in the input stream
newPositionwill receive the new position in the input stream

References vmime::end(), parsingContext::getDefaultContext(), and component::parseImpl().

◆ parseImpl()

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

◆ setDomainName()

void setDomainName ( const word & domainName)

Set the domain name of the address.

Parameters
domainNamedomain name of the address

References m_domainName.

◆ setLocalName()

void setLocalName ( const word & localName)

Set the local name of the address.

Parameters
localNamelocal name of the address

References m_localName.

◆ toString()

const string toString ( ) const

Returns the email address as a string, by joining components.

(ie. the local name, followed by a @ then the domain name.)

Returns
email address as a string

References generateImpl(), generationContext::getDefaultContext(), vmime::lineLengthLimits::infinite, and generationContext::setMaxLineLength().

◆ toText()

const text toText ( ) const

Returns the email address as multibyte text, by joining components.

(ie. the local name, followed by a @ then the domain name.)

Returns
email address as multibyte text

References text::appendWord(), m_domainName, m_localName, and vmime::charsets::US_ASCII.

Referenced by SMTPCommand::MAIL(), and SMTPCommand::RCPT().

Member Data Documentation

◆ m_domainName

◆ m_localName


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