Made to Order Software Corporation Logo

LLChatLib: LLMimeIndex Class Reference

LLMimeIndex Class Reference

Skeletal information useful for handling mime packages. More...

#include <llmime.h>

List of all members.

Public Member Functions

bool attachSubPart (LLMimeIndex sub_part)
 Add attachment information as a sub-part to a multipart mime.

 LLMimeIndex (const LLMimeIndex &mime)
 Copy constructor.

 LLMimeIndex (LLSD headers, S32 content_offset)
 Full constructor.

 LLMimeIndex ()
 Default constructor - creates a useless LLMimeIndex.

S32 contentLength () const
 Get the length of the data segment for this mime part.

std::string contentType () const
 Get the mime type associated with this node.

LLSD headers () const
 Get the full parsed headers for this.

bool isMultipart () const
 Helper method which simplifies parsing the return from type().

S32 offset () const
 Get the content offset.

LLMimeIndex subPart (S32 index) const
 Get the indicated attachment.

S32 subPartCount () const
 Get the number of atachments.


Detailed Description

Skeletal information useful for handling mime packages.

This file declares various tools for parsing and creating MIME objects as described in RFCs 2045, 2046, 2047, 2048, and 2049.

See also:
LLMimeParser

An instance of this class is the parsed output from a LLMimeParser which then allows for easy access into a data stream to find and get what you want out of it.

This class meant as a tool to quickly find what you seek in a parsed mime entity. As such, it does not have useful support for modification of a mime entity and specializes the interface toward querying data from a fixed mime entity. Modifying an instance of LLMimeIndx does not alter a mime entity and changes to a mime entity itself are not propogated into an instance of a LLMimeIndex.

Usage:
LLMimeIndex mime_index;
std::ifstream fstr("package.mime", ios::binary);
LLMimeParser parser;
if(parser.parseIndex(fstr, mime_index))
{
std::vector<U8> content;
content.resize(mime_index.contentLength());
fstr.seekg(mime_index.offset(), ios::beg);
// ...do work on fstr and content
}












Constructor & Destructor Documentation

LLMimeIndex::LLMimeIndex ( LLSD  headers,
S32  content_offset 
)

Full constructor.

Parameters:
headers The complete headers.
content_offset The number of bytes to the start of the data segment of this mime entity from the start of the stream or buffer.
LLMimeIndex::LLMimeIndex ( const LLMimeIndex mime  ) 

Copy constructor.

Parameters:
mime The other mime object.

Member Function Documentation

bool LLMimeIndex::attachSubPart ( LLMimeIndex  sub_part  ) 

Add attachment information as a sub-part to a multipart mime.

Parameters:
sub_part the part to attach.
Returns:
Returns true on success, false on failure.
S32 LLMimeIndex::contentLength (  )  const

Get the length of the data segment for this mime part.

Returns:
Returns the content length in bytes. Returns -1 if length is not known.
std::string LLMimeIndex::contentType (  )  const

Get the mime type associated with this node.

Returns:
Returns the mimetype.
LLSD LLMimeIndex::headers (  )  const

Get the full parsed headers for this.

If there are any headers, it will be a map of header name to the value found on the line. The name is everything before the colon, and the value is the string found after the colon to the end of the line after trimming leading whitespace. So, for example: Content-Type: text/plain would become an entry in the headers of: headers["Content-Type"] == "text/plain"

If this instance of an index was generated by the LLMimeParser::parseIndex() call, all header names in rfc2045 will be capitalized as in rfc, eg Content-Length and MIME-Version, not content-length and mime-version.

Returns:
Returns an LLSD map of header name to value. Returns undef if there are no headers.
bool LLMimeIndex::isMultipart (  )  const

Helper method which simplifies parsing the return from type().

Returns:
Returns true if this is a multipart mime, and therefore getting subparts will succeed.
S32 LLMimeIndex::offset (  )  const

Get the content offset.

Returns:
Returns the number of bytes to the start of the data segment from the start of serialized mime entity. Returns -1 if offset is not known.
LLMimeIndex LLMimeIndex::subPart ( S32  index  )  const

Get the indicated attachment.

Parameters:
index Value from 0 to (subPartCount() - 1).
Returns:
Returns the indicated sub-part, or an invalid mime index on failure.
S32 LLMimeIndex::subPartCount (  )  const

Get the number of atachments.

Returns:
Returns the number of sub-parts for this.

The documentation for this class was generated from the following files:
  • /home/doug/src/oss/slitechat/trunk/LLChatLib/llmessage/llmime.h
  • /home/doug/src/oss/slitechat/trunk/LLChatLib/llmessage/llmime.cpp
Generated on Thu Sep 23 17:18:42 2010 for LLChatLib by  doxygen 1.6.3