SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWMimeUtils Class Reference

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

#include <rw/mime/RWMimeUtils.h>

Static Public Member Functions

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

Static Public Attributes

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

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

◆ decode()

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.

◆ encode()

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.

◆ getUniqueBoundary()

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.

◆ headerDecode()

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.

◆ headerEncode()

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.

◆ replaceLineDelimiter()

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

◆ Base64

const RWCString RWMimeUtils::Base64
static

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

◆ Binary

const RWCString RWMimeUtils::Binary
static

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

◆ EightBit

const RWCString RWMimeUtils::EightBit
static

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

◆ QuotedPrintable

const RWCString RWMimeUtils::QuotedPrintable
static

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

◆ SevenBit

const RWCString RWMimeUtils::SevenBit
static

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

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