Yate
Public Member Functions | Protected Member Functions | List of all members
MimeMultipartBody Class Reference

MIME multipart container. More...

#include <yatemime.h>

Inheritance diagram for MimeMultipartBody:
MimeBody GenObject

Public Member Functions

 MimeMultipartBody (const char *subtype="mixed", const char *boundary=0)
 
 MimeMultipartBody (const String &type, const char *buf, int len)
 
 MimeMultipartBody (const MimeHeaderLine &type, const char *buf, int len)
 
virtual ~MimeMultipartBody ()
 
const ObjListbodies () const
 
void appendBody (MimeBody *body)
 
void removeBody (MimeBody *body, bool delobj=true)
 
MimeBodyfindBody (const String &content, MimeBody **start=0) const
 
virtual void * getObject (const String &name) const
 
virtual bool isMultipart () const
 
virtual MimeBodyclone () const
 
- Public Member Functions inherited from MimeBody
virtual ~MimeBody ()
 
const MimeHeaderLinegetType () const
 
MimeBodygetFirst (const String &type) const
 
const ObjListheaders () const
 
void appendHdr (MimeHeaderLine *hdr)
 
void removeHdr (MimeHeaderLine *hdr, bool delobj=true)
 
MimeHeaderLinefindHdr (const String &name, const MimeHeaderLine *start=0) const
 
void buildHeaders (String &buf)
 
bool setParam (const char *name, const char *value=0, const char *header=0)
 
bool delParam (const char *name, const char *header=0)
 
const NamedStringgetParam (const char *name, const char *header=0) const
 
const DataBlockgetBody () const
 
const DataBlockbody () const
 
virtual bool isSDP () const
 
- Public Member Functions inherited from GenObject
 GenObject ()
 
virtual ~GenObject ()
 
virtual bool alive () const
 
virtual void destruct ()
 
virtual const StringtoString () const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 

Protected Member Functions

 MimeMultipartBody (const MimeMultipartBody &original)
 
virtual void buildBody () const
 
void parse (const char *buf, int len)
 
- Protected Member Functions inherited from MimeBody
 MimeBody (const String &type)
 
 MimeBody (const MimeHeaderLine &type)
 

Additional Inherited Members

- Static Public Member Functions inherited from MimeBody
static MimeBodybuild (const char *buf, int len, const MimeHeaderLine &type)
 
static StringgetUnfoldedLine (const char *&buf, int &len)
 
- Static Public Member Functions inherited from GenObject
static void * getObject (const String &name, const GenObject *obj)
 
static bool getObjCounting ()
 
static void setObjCounting (bool enable)
 
static NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 
- Protected Attributes inherited from MimeBody
DataBlock m_body
 
ObjList m_headers
 

Detailed Description

MIME multipart container.

An object holding the bodies of a multipart MIME

Constructor & Destructor Documentation

MimeMultipartBody ( const char *  subtype = "mixed",
const char *  boundary = 0 
)
explicit

Constructor to build an empty multipart body

Parameters
subtypeThe multipart subtype
boundaryThe string used as separator for enclosed bodies. A random one will be created if missing. The length will be truncated to 70 if this value is exceeded
MimeMultipartBody ( const String type,
const char *  buf,
int  len 
)

Constructor from block of data

Parameters
typeThe value of the Content-Type header line
bufPointer to buffer of data
lenLength of data in buffer
MimeMultipartBody ( const MimeHeaderLine type,
const char *  buf,
int  len 
)

Constructor from block of data

Parameters
typeThe content type header line
bufPointer to buffer of data
lenLength of data in buffer
virtual ~MimeMultipartBody ( )
virtual

Destructor

MimeMultipartBody ( const MimeMultipartBody original)
protected

Copy constructor

Member Function Documentation

void appendBody ( MimeBody body)
inline

Append a body to this multipart

Parameters
bodyThe body to append

References ObjList::append().

const ObjList& bodies ( ) const
inline

Get the list of bodies enclosed contained in this multipart

Returns
The list of bodies enclosed contained in this multipart
virtual void buildBody ( ) const
protectedvirtual

Method that is called internally to build the binary encoded body

Implements MimeBody.

virtual MimeBody* clone ( ) const
virtual

Duplicate this MIME body

Returns
Copy of this MIME body

Implements MimeBody.

MimeBody* findBody ( const String content,
MimeBody **  start = 0 
) const

Find a body. Enclosed multiparts are also searched for the requested body

Parameters
contentThe value of the body to find. Must be lower case
startThe starting point in the list. 0 to start from the beginning. Be aware that this parameter is used internally to search within enclosed multipart bodies and set to 0 when the starting point is found
Returns
Pointer to MimeBody or 0 if not found
virtual void* getObject ( const String name) const
virtual

RTTI method, get a pointer to a derived class given the class name

Parameters
nameName of the class we are asking for
Returns
Pointer to the requested class or NULL if this object doesn't implement it

Reimplemented from MimeBody.

virtual bool isMultipart ( ) const
inlinevirtual

Check if this body is multipart (can hold other MIME bodies)

Returns
True if this body is multipart

Reimplemented from MimeBody.

void parse ( const char *  buf,
int  len 
)
protected

Parse a data buffer and append any valid body to this multipart Ignore prolog, epilog and invalid bodies

Parameters
bufPointer to buffer of data
lenLength of data in buffer
void removeBody ( MimeBody body,
bool  delobj = true 
)
inline

Remove a body from this multipart

Parameters
bodyThe body to remove
delobjTrue to delete the body, false to remove from list without deleting it

References ObjList::remove().


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