VMime
parameter Class Reference

#include <parameter.hpp>

Inheritance diagram for parameter:
Collaboration diagram for parameter:

Public Member Functions

 parameter (const string &name)
 parameter (const string &name, const word &value)
 parameter (const string &name, const string &value)
shared_ptr< componentclone () const
void copyFrom (const component &other)
parameter & operator= (const parameter &other)
size_t getGeneratedSize (const generationContext &ctx)
const std::vector< shared_ptr< component > > getChildComponents ()
const stringgetName () const
const wordgetValue () const
template<typename T>
const T getValueAs () const
void setValue (const component &value)
void setValue (const word &value)
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)
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
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
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 ()

Constructor & Destructor Documentation

◆ parameter() [1/3]

parameter ( const string & name)

Construct a parameter with no value.

Charset is set to the current locale charset.

Parameters
nameparameter name

◆ parameter() [2/3]

parameter ( const string & name,
const word & value )

Construct a parameter given a name and a value.

Parameters
nameparameter name
valueparameter value

◆ parameter() [3/3]

parameter ( const string & name,
const string & value )

Construct a parameter given a name and a string value expressed in the current locale charset.

Parameters
nameparameter name
valueparameter value

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().

Referenced by operator=().

◆ generateImpl()

◆ getChildComponents()

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

Return the list of children of this component.

Returns
list of child components

Implements component.

◆ getGeneratedSize()

size_t getGeneratedSize ( const generationContext & ctx)
virtual

Get the number of bytes that will be used by this component when it is generated.

This may be a heuristically-derived estimate, but such an estimated size should always be larger than the actual generated size.

Parameters
ctxgeneration context
Returns
component size when generated

Reimplemented from component.

References stringUtils::countASCIIchars(), generationContext::getMaxLineLength(), and vmime::NEW_LINE_SEQUENCE_LENGTH.

◆ getName()

const string & getName ( ) const

Return the name of this parameter.

Returns
name of this parameter

◆ getValue()

const word & getValue ( ) const

Return the raw value of this parameter.

Returns
read-only value

◆ getValueAs()

template<typename T>
const T getValueAs ( ) const

Return the value of this object in the specified type.

For example, the following code:

   getParameter("creation-date")->getValueAs <vmime::dateTime>()

is equivalent to:

   shared_ptr <vmime::word> rawValue = getParameter("creation-date");

   vmime::dateTime theDate;
   theDate.parse(rawValue->getBuffer());
Parameters
Ttype to which convert the value
Returns
value

◆ operator=()

parameter & operator= ( const parameter & other)

References copyFrom().

◆ parseImpl()

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

◆ setValue() [1/2]

void setValue ( const component & value)

Set the value of this parameter.

Parameters
valuenew value

References component::component(), component::generate(), setValue(), and vmime::charsets::US_ASCII.

Referenced by setValue().

◆ setValue() [2/2]

void setValue ( const word & value)

Set the raw value of this parameter.

Parameters
valuenew value

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