LLMimeIndex Class Reference

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

#include <llmime.h>

Collaboration diagram for LLMimeIndex:

Collaboration graph
[legend]

List of all members.

Public Member Functions

LLSD headers () const
 Get the full parsed headers for this.
S32 offset () const
 Get the content offset.
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.
bool isMultipart () const
 Helper method which simplifies parsing the return from type().
S32 subPartCount () const
 Get the number of atachments.
LLMimeIndex subPart (S32 index) const
 Get the indicated attachment.
 LLMimeIndex ()
 Default constructor - creates a useless LLMimeIndex.
 LLMimeIndex (LLSD headers, S32 content_offset)
 Full constructor.
 LLMimeIndex (const LLMimeIndex &mime)
 Copy constructor.
 ~LLMimeIndex ()
LLMimeIndexoperator= (const LLMimeIndex &mime)
bool attachSubPart (LLMimeIndex sub_part)
 Add attachment information as a sub-part to a multipart mime.

Protected Attributes

ImplmImpl

Classes

class  Impl
 Implementation details of the mime index class. More...


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
}

Definition at line 73 of file llmime.h.


Constructor & Destructor Documentation

LLMimeIndex::LLMimeIndex (  ) 

Default constructor - creates a useless LLMimeIndex.

Definition at line 173 of file llmime.cpp.

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.

Definition at line 177 of file llmime.cpp.

LLMimeIndex::LLMimeIndex ( const LLMimeIndex mime  ) 

Copy constructor.

Parameters:
mime The other mime object.

Definition at line 182 of file llmime.cpp.

References mImpl, and LLMimeIndex::Impl::mUseCount.

LLMimeIndex::~LLMimeIndex (  ) 

Definition at line 188 of file llmime.cpp.

References mImpl, and LLMimeIndex::Impl::mUseCount.


Member Function Documentation

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.

Definition at line 109 of file llmime.cpp.

References LLMimeIndex::Impl::mHeaders, and mImpl.

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.

Definition at line 114 of file llmime.cpp.

References mImpl, and LLMimeIndex::Impl::mOffset.

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.

Definition at line 119 of file llmime.cpp.

References LLSD::asInteger(), CONTENT_LENGTH(), LLSD::isDefined(), LLMimeIndex::Impl::mHeaders, mImpl, and S32.

Here is the call graph for this function:

std::string LLMimeIndex::contentType (  )  const

Get the mime type associated with this node.

Returns:
Returns the mimetype.

Definition at line 131 of file llmime.cpp.

References LLSD::asString(), CONTENT_TYPE(), LLSD::isDefined(), LLMimeIndex::Impl::mHeaders, and mImpl.

Here is the call graph for this function:

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.

Definition at line 142 of file llmime.cpp.

References LLSD::asString(), CONTENT_TYPE(), LLSD::isDefined(), LLMimeIndex::Impl::mHeaders, mImpl, and MULTIPART().

Referenced by LLMimeParser::Impl::parseIndex().

Here is the call graph for this function:

Here is the caller graph for this function:

S32 LLMimeIndex::subPartCount (  )  const

Get the number of atachments.

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

Definition at line 158 of file llmime.cpp.

References LLMimeIndex::Impl::mAttachments, and mImpl.

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.

Definition at line 163 of file llmime.cpp.

References LLMimeIndex::Impl::mAttachments, mImpl, and S32.

LLMimeIndex & LLMimeIndex::operator= ( const LLMimeIndex mime  ) 

Definition at line 196 of file llmime.cpp.

References mImpl, and LLMimeIndex::Impl::mUseCount.

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.

Definition at line 209 of file llmime.cpp.

References LLMimeIndex::Impl::mAttachments, mImpl, and S32_MAX.

Referenced by LLMimeParser::Impl::parseIndex().

Here is the caller graph for this function:


Member Data Documentation

Impl* LLMimeIndex::mImpl [protected]


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

Generated on Fri May 16 08:53:42 2008 for SecondLife by  doxygen 1.5.5