SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWMimeParameter Class Reference

Represents a parameter within the content of a MIME header. More...

#include <rw/mime/RWMimeParameter.h>

Public Member Functions

 RWMimeParameter (const RWCString &name, const RWCString &value)
 
 RWMimeParameter (const RWMimeParameter &second)
 
 RWMimeParameter (void)
 
 ~RWMimeParameter (void)
 
RWCString asString (void) const
 
void fromString (const RWCString &parameterString)
 
RWCString getName (void) const
 
RWCString getValue (void) const
 
RWMimeParameteroperator= (const RWMimeParameter &second)
 
void setName (const RWCString &name)
 
void setValue (const RWCString &value)
 

Friends

bool operator== (const RWMimeParameter &first, const RWMimeParameter &second)
 

Detailed Description

RWMimeParameter represents a parameter within the value of a MIME header. Each MIME parameter has a name and a value. An equal sign separates the name and the value. For example, the parameter charset=US-ASCII contains the name charset and the value US-ASCII.

The parameter name may consist of US-ASCII characters with the exception of control characters, space, or any of the special characters shown below:

()<>@,;:\"/[]?=

The parameter value may contain any US-ASCII character with the exception of US-ASCII control characters, carriage return, and linefeed.

Reference
RWMimeParameter creates parameters in the syntax specified by RFC 2045, Section 5 (p. 9-12) and in compliance with RFC 2822.

Constructor & Destructor Documentation

◆ RWMimeParameter() [1/3]

RWMimeParameter::RWMimeParameter ( void )

Default constructor. Constructs a parameter with an empty name and an empty value.

Note
A parameter with an empty name and an empty value does not meet the specification of a MIME Content-Type parameter.

◆ RWMimeParameter() [2/3]

RWMimeParameter::RWMimeParameter ( const RWCString & name,
const RWCString & value )

Constructs a parameter with the given name and value. Does not validate name or value. The RWCString should contain 7-bit US-ASCII data.

◆ RWMimeParameter() [3/3]

RWMimeParameter::RWMimeParameter ( const RWMimeParameter & second)

Copy constructor. Constructs a new parameter as a deep copy of second.

◆ ~RWMimeParameter()

RWMimeParameter::~RWMimeParameter ( void )

Destructor.

Member Function Documentation

◆ asString()

RWCString RWMimeParameter::asString ( void ) const

Returns this parameter as a string. Produces a string in the format name="value". Escapes the parameter value as necessary to generate a correctly quoted and escaped string. Does not otherwise validate the returned string. Throws RWMimeError if self cannot be represented as valid MIME. The RWCString should contain 7-bit US-ASCII data.

◆ fromString()

void RWMimeParameter::fromString ( const RWCString & parameterString)

Populates self with the contents of parameterString. Throws RWMimeParseError if the function cannot parse parameterString as a valid MIME parameter. The RWCString should contain 7-bit US-ASCII data.

◆ getName()

RWCString RWMimeParameter::getName ( void ) const

Returns the name of this parameter. The RWCString should contain 7-bit US-ASCII data.

◆ getValue()

RWCString RWMimeParameter::getValue ( void ) const

Returns the value of this parameter. The RWCString should contain 7-bit US-ASCII data.

◆ operator=()

RWMimeParameter & RWMimeParameter::operator= ( const RWMimeParameter & second)

Assignment operator. Makes self a deep copy of second.

◆ setName()

void RWMimeParameter::setName ( const RWCString & name)

Sets the name of this parameter to name. Does not validate name. The RWCString should contain 7-bit US-ASCII data.

◆ setValue()

void RWMimeParameter::setValue ( const RWCString & value)

Sets the value of this parameter to value. The RWCString should contain 7-bit US-ASCII data.

Friends And Related Symbol Documentation

◆ operator==

bool operator== ( const RWMimeParameter & first,
const RWMimeParameter & second )
friend

Equality operator. Returns true if first and second are equal, false otherwise. Uses a case-insensitive string comparison for parameter names, a case-sensitive string comparison for parameter values.

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.