#include <llmime.h>
Collaboration diagram for LLMimeIndex:
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 () | |
LLMimeIndex & | operator= (const LLMimeIndex &mime) |
bool | attachSubPart (LLMimeIndex sub_part) |
Add attachment information as a sub-part to a multipart mime. | |
Protected Attributes | |
Impl * | mImpl |
Classes | |
class | Impl |
Implementation details of the mime index class. More... |
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.
LLMimeIndex::LLMimeIndex | ( | ) |
Full constructor.
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.
mime | The other mime object. |
Definition at line 182 of file llmime.cpp.
References mImpl, and LLMimeIndex::Impl::mUseCount.
LLMimeIndex::~LLMimeIndex | ( | ) |
bool LLMimeIndex::attachSubPart | ( | LLMimeIndex | sub_part | ) |
Add attachment information as a sub-part to a multipart mime.
sub_part | the part to attach. |
Definition at line 209 of file llmime.cpp.
References LLMimeIndex::Impl::mAttachments, mImpl, and S32_MAX.
Referenced by LLMimeParser::Impl::parseIndex().
S32 LLMimeIndex::contentLength | ( | ) | const |
Get the length of the data segment for this mime part.
Definition at line 119 of file llmime.cpp.
References LLSD::asInteger(), CONTENT_LENGTH(), LLSD::isDefined(), LLMimeIndex::Impl::mHeaders, mImpl, and S32.
std::string LLMimeIndex::contentType | ( | ) | const |
Get the mime type associated with this node.
Definition at line 131 of file llmime.cpp.
References LLSD::asString(), CONTENT_TYPE(), LLSD::isDefined(), LLMimeIndex::Impl::mHeaders, mImpl, and type.
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.
Definition at line 109 of file llmime.cpp.
References LLMimeIndex::Impl::mHeaders, and mImpl.
bool LLMimeIndex::isMultipart | ( | ) | const |
Helper method which simplifies parsing the return from type().
Definition at line 142 of file llmime.cpp.
References LLSD::asString(), CONTENT_TYPE(), LLSD::isDefined(), LLMimeIndex::Impl::mHeaders, mImpl, MULTIPART(), and type.
Referenced by LLMimeParser::Impl::parseIndex().
S32 LLMimeIndex::offset | ( | ) | const |
Get the content offset.
Definition at line 114 of file llmime.cpp.
References mImpl, and LLMimeIndex::Impl::mOffset.
LLMimeIndex & LLMimeIndex::operator= | ( | const LLMimeIndex & | mime | ) |
LLMimeIndex LLMimeIndex::subPart | ( | S32 | index | ) | const |
Get the indicated attachment.
index | Value from 0 to (subPartCount() - 1). |
Definition at line 163 of file llmime.cpp.
References LLMimeIndex::Impl::mAttachments, mImpl, and S32.
S32 LLMimeIndex::subPartCount | ( | ) | const |
Get the number of atachments.
Definition at line 158 of file llmime.cpp.
References LLMimeIndex::Impl::mAttachments, and mImpl.
Impl* LLMimeIndex::mImpl [protected] |
Definition at line 196 of file llmime.h.
Referenced by attachSubPart(), contentLength(), contentType(), headers(), isMultipart(), LLMimeIndex(), offset(), operator=(), subPart(), subPartCount(), and ~LLMimeIndex().