WriteMime::DiscreteEntity Class Reference

A DiscreteEntity represents a MIME entity with a discrete media type, it can be used either as the base for a simple message or as a part of a CompositeEntity. More...

#include <writemime.h>

Inheritance diagram for WriteMime::DiscreteEntity:

Inheritance graph
[legend]
Collaboration diagram for WriteMime::DiscreteEntity:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void setTextEncodePref (encoding ec)
 Set encoding preference for 8 bit text: either 8bit or quoted-printable.
virtual void setCharSet (const char *cs)
 Set the character set for a TEXT body.
virtual int setBody (const char *bp, int blen, type tp=TEXT, const char *stp="plain")
 Create body from data buffer.
virtual int setBodyAttach (const char *filename, type tp=APPLICATION, const char *stp="octet-stream")
 Create body by attaching file (will be encoded in BASE64).
virtual int size ()
 Compute storage size, including final 0 byte.
virtual const char * format ()
 Return malloc'd, 0-terminated buffer of formatted contents.
virtual int format (char *buf)
 Format into caller buffer, which must be at least size() bytes wide.


Detailed Description

A DiscreteEntity represents a MIME entity with a discrete media type, it can be used either as the base for a simple message or as a part of a CompositeEntity.


Member Function Documentation

int WriteMime::DiscreteEntity::setBody ( const char *  bp,
int  blen,
type  tp = TEXT,
const char *  stp = "plain" 
) [virtual]

Create body from data buffer.

If the type is TEXT, the buffer transfer-encoding will be 7BIT if the data is ascii, or else either QP or 8BIT (depending on textencodepref).

If the type is not TEXT, the buffer will be encoded in BASE64.

Parameters:
bp points to body text (no need for final 0, may be binary).
blen is the input buffer size.
tp MIME type for data.
stp MIME subtype.
Returns:
-1 for error, 0 else.

References WriteMime::base64Encode(), WriteMime::qpEncode(), and WriteMime::Entity::seterror().

int WriteMime::DiscreteEntity::setBodyAttach ( const char *  filename,
type  tp = APPLICATION,
const char *  stp = "octet-stream" 
) [virtual]

Create body by attaching file (will be encoded in BASE64).

Parameters:
filename file name.
tp MIME type for data.
stp MIME subtype.
Returns:
-1 for error, 0 else.

References WriteMime::Entity::addHeaderField(), and WriteMime::base64EncodeFile().


The documentation for this class was generated from the following files:

Generated on Fri Feb 6 11:53:42 2009 for WriteMIME by  doxygen 1.5.7.1