rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWMimeUtils Class Reference
[MIME]

Provides utility functions commonly needed by MIME applications. More...

#include <rw/mime/RWMimeUtils.h>

List of all members.

Static Public Member Functions

static RWCString encode (const RWCString &str, const RWCString &encoding)
static RWCString decode (const RWCString &str, const RWCString &encoding)
static RWCString headerEncode (const RWCString &str, const RWCString &charset, const RWCString &encoding)
static RWCString headerDecode (const RWCString &str, RWCString &charset)
static RWCString getUniqueBoundary (void)
static RWCString replaceLineDelimiter (const RWCString &str, const RWCString &delim="\r\n")

Static Public Attributes

static const RWCString QuotedPrintable
static const RWCString Base64
static const RWCString SevenBit
static const RWCString EightBit
static const RWCString Binary

Detailed Description

RWMimeUtils provides utility functions commonly needed by MIME applications. There is no need to instantiate this class, since it contains only static functions and static constants.


Member Function Documentation

static RWCString RWMimeUtils::decode ( const RWCString str,
const RWCString encoding 
) [static]

Decodes the string str according to the encoding method encoding. Throws RWMimeError if encoding is not recognized. See the Internet Protocols Module User's Guide for a discussion of encodings. The RWCString should contain 7-bit US-ASCII data.

static RWCString RWMimeUtils::encode ( const RWCString str,
const RWCString encoding 
) [static]

Encodes the string str according to the encoding method encoding. Throws RWMimeError if encoding is not recognized. See the Internet Protocols Module User's Guide for a discussion of encodings. The RWCString should contain 7-bit US-ASCII data.

static RWCString RWMimeUtils::getUniqueBoundary ( void   )  [static]

Generates a unique string for use as the value of a boundary parameter. The generated string is of the form

 _=_next_part_<milliseconds>_=_

where <milliseconds> is the number of milliseconds since 00:00:00:000 January 1, 1901 UTC. The RWCString should contain 7-bit US-ASCII data.

Note:
This function generates unique boundaries suitable for most messages and many applications. However, the function generates duplicate values if called more than once a millisecond.
static RWCString RWMimeUtils::headerDecode ( const RWCString str,
RWCString charset 
) [static]

Decodes the header value string str. If str is not a string encoded for use in an header, this function returns the original string, and the charset variable is set to US-ASCII. If the string is encoded, the unencoded string is returned, with the charset variable set to the charset of the returned string.

static RWCString RWMimeUtils::headerEncode ( const RWCString str,
const RWCString charset,
const RWCString encoding 
) [static]

Encodes the string str according to the encoding method encoding for use as a value in a MIME header. Throws RWMimeError if encoding is not recognized. Currently, the recognized encodings are "B" and "Q" as specified in RFC 2047.

static RWCString RWMimeUtils::replaceLineDelimiter ( const RWCString str,
const RWCString delim = "\r\n" 
) [static]

Translates the format of the text in str by replacing all occurrences of '\r', '\n' and "\r\n" in str with delim. By default, the function translates str to canonical form for text. Providing a different value for delim converts str to a platform-specific text format. An application sending a message typically converts a text part body to canonical form before encoding the text or inserting the text into a message. An application receiving a message typically converts a text part body to a platform-specific format after retrieving the body from the message and decoding the body. See RFC 2049, section 4 or the Internet Protocols Module User's Guide for a discussion of canonical form.

Note:
Do not use this function on unencoded binary data.

Member Data Documentation

Static constant string containing "base64", for use with encode() and decode().

Static constant string containing "binary", for use with encode() and decode().

Static constant string containing "8bit", for use with encode() and decode().

Static constant string containing "quoted-printable", for use with encode() and decode().

Static constant string containing "7bit", for use with encode() and decode().

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.