class MimeBody

# class MimeBody | Abstract MIME data holder. More...
Contains pure virtuals
Full name | `TelEngine::MimeBody`
Definition | `#include <yatemime.h>`
Inherits | TelEngine::GenObject [public ]
Inherited by | MimeBinaryBody, MimeLinesBody, MimeMultipartBody, MimeSdpBody, MimeStringBody
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- virtual ~MimeBody ()
- virtual void* getObject (const String& name) const
- inline const MimeHeaderLine& getType () const
- MimeBody* getFirst (const String& type) const
- inline const ObjList& headers () const
- inline void appendHdr (MimeHeaderLine* hdr)
- inline void removeHdr (MimeHeaderLine* hdr, bool delobj = true)
- MimeHeaderLine* findHdr (const String& name, const MimeHeaderLine* start = 0) const
- inline 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 NamedString* getParam (const char* name, const char* header = 0) const
- const DataBlock& getBody () const
- inline const DataBlock& body () const
- virtual bool isSDP () const
- virtual bool isMultipart () const
- virtual MimeBody* clone () const

#### Public Static Methods

- static MimeBody* build (const char* buf, int len, const MimeHeaderLine& type)
- static String* getUnfoldedLine (const char*& buf, int& len)

#### Protected Methods

- MimeBody (const String& type)
- MimeBody (const MimeHeaderLine& type)
- virtual void buildBody () const

#### Protected Members

- mutable DataBlock m_body
- ObjList m_headers

## Detailed Description

Abstract base class for holding Multipurpose Internet Mail Extensions data. Keeps a Content-Type header line with body type and parameters and any additional header lines the body may have. The body type contains lower case characters.

~MimeBody () | ### ~MimeBody

[virtual]

Destructor

void* getObject (const String& name) | ### getObject

[const virtual]

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

Parameters:

name | Name of the class we are asking for

Returns: Pointer to the requested class or NULL if this object doesn't implement it

Reimplemented from GenObject.

inline const MimeHeaderLine& getType () | ### getType

[const]

Retrieve the MIME type of this body

Returns: Name of the MIME type/subtype

MimeBody* getFirst (const String& type) | ### getFirst

[const]

Get the first body that matches a requested type, descends into multiparts

Parameters:

type | Name of the MIME type to search for

Returns: Pointer to requested body or NULL if not found

inline const ObjList& headers () | ### headers

[const]

Retrieve the additional headers of this MIME body (other then Content-Type)

Returns: The list of header lines of this MIME body

inline void appendHdr (MimeHeaderLine* hdr) | ### appendHdr

Append an additional header line to this body

Parameters:

hdr | The header line to append

inline void removeHdr (MimeHeaderLine* hdr, bool delobj = true) | ### removeHdr

Remove an additional header line from this body

Parameters:

hdr | The header line to remove
delobj | True to delete the header, false to remove from list without deleting it

MimeHeaderLine* findHdr (const String& name, const MimeHeaderLine* start = 0) | ### findHdr

[const]

Find an additional header line by its name. The names are compared case insensitive

Parameters:

name | The name of the header to find
start | The starting point in the list. 0 to start from the beginning

Returns: Pointer to MimeHeaderLine or 0 if not found

inline void buildHeaders (String& buf) | ### buildHeaders

Build a string with this body's header lines

Parameters:

buf | Destination string

bool setParam (const char* name, const char* value = 0, const char* header = 0) | ### setParam

Replace the value of an existing parameter or add a new one

Parameters:

name | Parameter's name
value | Parameter's value
header | Header whose parameter will be changed. Set to 0 to use the body's content type header

Returns: False if the header doesn't exist

bool delParam (const char* name, const char* header = 0) | ### delParam

Remove a header parameter

Parameters:

name | Parameter's name
header | Header whose parameter will be removed. Set to 0 to use the body's content type header

Returns: False if the header doesn't exist

const NamedString* getParam (const char* name, const char* header = 0) | ### getParam

[const]

Get a header parameter

Parameters:

name | Parameter's name
header | Header whose parameter will be retrieved. Set to 0 to use the body's content type header

Returns: Pointer to the desired parameter or 0 if not found

const DataBlock& getBody () | ### getBody

[const]

Retrieve the binary encoding of this MIME body. Build the body if empty. The body doesn't contain the Content-Type header or the additional headers

Returns: Block of binary data

inline const DataBlock& body () | ### body

[const]

Get the binary data of this MIME body without building it.

Returns: Block of binary data

bool isSDP () | ### isSDP

[const virtual]

Check if this body is a Session Description Protocol

Returns: True if this body holds a SDP

bool isMultipart () | ### isMultipart

[const virtual]

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

Returns: True if this body is multipart

MimeBody* clone () | ### clone

[const pure virtual]

Duplicate this MIME body

Returns: Copy of this MIME body

MimeBody* build (const char* buf, int len, const MimeHeaderLine& type) | ### build

[static]

Method to build a MIME body from a type and data buffer. Unknown body types are built into a binary body. Exactly 1 leading CRLF is removed from the beginning of the buffer if found before building it

Parameters:

buf | Pointer to buffer of data just after the body headers
len | Length of data in buffer
type | The header line declaring the body's content. Usually this is a Content-Type header line

Returns: Newly allocated MIME body or NULL if the buffer is empty

String* getUnfoldedLine (const char*& buf, int& len) | ### getUnfoldedLine

[static]

Utility method, returns an unfolded line and advances the pointer

Parameters:

buf | Reference to pointer to start of buffer data
len | Reference to variable holding buffer length

Returns: Newly allocated String holding the line of text

MimeBody (const String& type) | ### MimeBody

[protected]

Constructor to be used only by derived classes. Converts the MIME type string to lower case

Parameters:

type | The value of the Content-Type header line

MimeBody (const MimeHeaderLine& type) | ### MimeBody

[protected]

Constructor to be used only by derived classes. Builds this body from a header line. Converts the MIME type string to lower case

Parameters:

type | The content type header line

void buildBody () | ### buildBody

[protected const pure virtual]

Method that is called internally to build the binary encoded body

mutable DataBlock m_body | ### m_body

[protected]

ObjList m_headers | ### m_headers

[protected]

Generated by: paulc on bussard on Fri May 8 12:37:22 2015, using kdoc 2.0a54.