SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Protected Member Functions
RWMimeGenericHeader Class Reference

Represents Internet Message Format headers other than the headers defined by MIME. More...

#include <rw/mime/RWMimeGenericHeader.h>

Inheritance diagram for RWMimeGenericHeader:
RWMimeHeader RWHandleBase

Public Member Functions

 RWMimeGenericHeader (void)
 
 RWMimeGenericHeader (const RWCString &label, const RWCString &value)
 
 RWMimeGenericHeader (const RWMimeGenericHeader &second)
 
 RWMimeGenericHeader (const RWMimeHeader &second)
 
virtual ~RWMimeGenericHeader (void)
 
RWCString getValue (void) const
 
RWMimeGenericHeaderoperator= (const RWMimeGenericHeader &second)
 
void setValue (const RWCString &value)
 
- Public Member Functions inherited from RWMimeHeader
 RWMimeHeader (void)
 
 RWMimeHeader (const RWCString &label)
 
 RWMimeHeader (const RWMimeHeader &second)
 
virtual ~RWMimeHeader (void)
 
RWCString asString (void) const
 
void fromString (const RWCString &headerString)
 
RWCString getLabel (void) const
 
RWMimeHeaderoperator= (const RWMimeHeader &second)
 
- Public Member Functions inherited from RWHandleBase
bool isValid (void) const
 
bool operator!= (const RWHandleBase &second) const
 
bool operator< (const RWHandleBase &second) const
 
bool operator== (const RWHandleBase &second) const
 

Protected Member Functions

RWMimeUnstructuredHeaderImp & body (void) const
 
virtual bool checkLabel (const RWCString &label) const
 
- Protected Member Functions inherited from RWMimeHeader
RWMimeHeaderImp & body (void) const
 
- Protected Member Functions inherited from RWHandleBase
 RWHandleBase (void)
 
 RWHandleBase (RWStaticCtor)
 
 RWHandleBase (RWBodyBase *body)
 
 RWHandleBase (const RWHandleBase &second)
 
 ~RWHandleBase (void)
 
RWBodyBasebody (void) const
 
RWHandleBaseoperator= (const RWHandleBase &second)
 

Detailed Description

RWMimeGenericHeader represents Internet Message Format headers other than the headers defined by MIME. A header consists of a label and a value. MIME requires that both the label and value contain only printable characters in the US-ASCII character set. The name may not contain a colon. To create a header with a value in another character set, encode the value according to the guidelines in RFC 2047.

The label appears first in the header, and is separated from the value by a colon. So, the header line

From: Rudi Marquez <rudi_marqez@roguewave.com>

contains the label From, a colon as a separator, and the value Rudi Marquez <rudi_marquez@roguewave.com>. RWMimeGenericHeader represents this structure by containing a pair of strings, one string for the label and one string for the value.

This class only represents headers which are not defined in the MIME specification. For MIME headers, use the class corresponding to the header instead. The class enforces this constraint by refusing to accept a label for another header type. The constructors and assignment operator throw RWMimeError if the label provided is a label for any other header type.

An instance of this class is a handle to a private, reference-counted body.

Reference
RWMimeGenericHeader conforms to the header requirements specified in Section 2.2 (p. 7) of RFC 2822, the Internet Message Format specification. RFC 2822 is an update of RFC 822, which originally defined the format for Internet message headers.

Constructor & Destructor Documentation

RWMimeGenericHeader::RWMimeGenericHeader ( void  )

Default constructor. Constructs a header with an empty label and an empty value.

Note
A header with an empty label and an empty value does not meet the requirements of an Internet Message Format header.
RWMimeGenericHeader::RWMimeGenericHeader ( const RWCString label,
const RWCString value 
)

Constructs a header with the given label and value. Does not verify that the strings provided meet the requirements for an Internet Message Format header. Throws RWMimeError if label is the label for one of the other header classes. The RWCString should contain 7-bit US-ASCII data.

RWMimeGenericHeader::RWMimeGenericHeader ( const RWMimeGenericHeader second)

Copy constructor. Constructs a new handle to the body second refers to.

RWMimeGenericHeader::RWMimeGenericHeader ( const RWMimeHeader second)

Conversion constructor. Constructs a new handle to the body second refers to. Throws RWMimeError if the label of second is the label for one of the other header classes.

virtual RWMimeGenericHeader::~RWMimeGenericHeader ( void  )
virtual

Destructor.

Member Function Documentation

RWMimeUnstructuredHeaderImp& RWMimeGenericHeader::body ( void  ) const
protected

Returns a reference to the underlying implementation.

virtual bool RWMimeGenericHeader::checkLabel ( const RWCString label) const
protectedvirtual

Returns true if label is not the label for one of the other header classes, false otherwise. The RWCString should contain 7-bit US-ASCII data.

Reimplemented from RWMimeHeader.

RWCString RWMimeGenericHeader::getValue ( void  ) const

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

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

Assignment operator. Makes self a handle identical to second. Throws RWMimeError if the label of second is the label for one of the other header classes.

void RWMimeGenericHeader::setValue ( const RWCString value)

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

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