Module: Internet Protocols Module Package: MIME
Does not inherit
Base64 Binary decode() |
EightBit encode() getUniqueBoundary() |
headerDecode() headerEncode() QuotedPrintable |
replaceLineDelimiter() SevenBit |
#include <rw/mime/RWMimeUtils.h>
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.
static const RWCString Base64;
Static constant string containing "base64", for use with encode() and decode().
static const RWCString Binary;
Static constant string containing "binary", for use with encode() and decode().
static const RWCString EightBit;
Static constant string containing "8bit", for use with encode() and decode().
static const RWCString QuotedPrintable;
Static constant string containing "quoted-printable", for use with encode() and decode().
static const RWCString SevenBit;
Static constant string containing "7bit", for use with encode() and decode().
static RWCString decode(const RWCString& str, const RWCString& encoding);
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 encode(const RWCString& str, const RWCString& encoding);
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 getUniqueBoundary(void);
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 headerDecode(const RWCString& str, RWCString& charset);
Decodes the header value string str. If the 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 headerEncode(const RWCString& str, const RWCString& charset, const RWCString& encoding);
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 replaceLineDelimiter(const RWCString& str, const RWCString& delim = "\r\n");
Translates the format of the text in str by replacing all occurrences of CR, LF and CRLF 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 binary data or encoded data.
© 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.