|
VMime
|
#include <body.hpp>


Static Public Member Functions | |
| static const string | generateRandomBoundaryString () |
| static bool | isValidBoundary (const string &boundary) |
Protected Member Functions | |
| size_t | findNextBoundaryPosition (shared_ptr< utility::parserInputStreamAdapter > parser, const string &boundary, const size_t position, const size_t end, size_t *boundaryStart, size_t *boundaryEnd) |
| void | parseImpl (const parsingContext &ctx, shared_ptr< utility::parserInputStreamAdapter > parser, const size_t position, const size_t end, size_t *newPosition=NULL) |
| void | generateImpl (const generationContext &ctx, utility::outputStream &os, const size_t curLinePos=0, size_t *newLinePos=NULL) const |
Protected Member Functions inherited from component | |
| void | setParsedBounds (const size_t start, const size_t end) |
| virtual void | parseImpl (const parsingContext &ctx, const string &buffer, const size_t position, const size_t end, size_t *newPosition=NULL) |
Protected Member Functions inherited from object | |
| object () | |
| object (const object &) | |
| object & | operator= (const object &) |
| virtual | ~object () |
Body section of a MIME part.
| body | ( | ) |
| ~body | ( | ) |
| void appendPart | ( | shared_ptr< bodyPart > | part | ) |
|
virtual |
Clone this component.
Implements component.
References vmime::dynamicCast().
Replace data in this component by data in other component.
Both components must be of the same type.
| std::bad_cast_exception | if the components are not of the same (dynamic) type |
| other | other component to copy data from |
Implements component.
References bodyPart::createChildPart(), vmime::dynamicCast(), and body::removeAllParts().
Referenced by body::operator=().
|
protected |
Finds the next boundary position in the parsing buffer.
| parser | parser object |
| boundary | boundary string (without "--" nor CR/LF) |
| position | start position |
| end | end position |
| boundaryStart | will hold the start position of the boundary (including any CR/LF and "--" before the boundary) |
| boundaryEnd | will hold the end position of the boundary (position just before the CRLF or "--" which follows) |
References vmime::dynamicCast(), vmime::end(), and vmime::npos.
Referenced by body::parseImpl().
|
protectedvirtual |
Implements component.
References vmime::fields::CONTENT_TYPE, vmime::CRLF, vmime::dynamicCast(), text::FORCE_NO_ENCODING, body::generateRandomBoundaryString(), contentTypeField::getBoundary(), body::getContentType(), body::getEncoding(), bodyPart::getHeader(), body::getPartAt(), body::getPartCount(), and text::NO_NEW_LINE_SEQUENCE.
Generate a new random boundary string.
References vmime::dynamicCast(), random::getNext(), and random::getTime().
Referenced by body::generateImpl().
Return the charset of the data contained in the body contents.
This is a shortcut for getHeader()->ContentType()->getCharset() on the parent part.
References vmime::fields::CONTENT_TYPE, vmime::dynamicCast(), bodyPart::getHeader(), and vmime::charsets::US_ASCII.
|
virtual |
Return the list of children of this component.
Implements component.
References vmime::copy_vector().
| const shared_ptr< const contentHandler > getContents | ( | ) | const |
Return a read-only reference to body contents.
Return the media type of the data contained in the body contents.
This is a shortcut for getHeader()->ContentType()->getValue() on the parent part.
References vmime::fields::CONTENT_TYPE, vmime::dynamicCast(), bodyPart::getHeader(), headerField::getValue(), vmime::mediaTypes::TEXT, and vmime::mediaTypes::TEXT_PLAIN.
Referenced by body::generateImpl().
Return the encoding used to encode the body contents.
This is a shortcut for getHeader()->ContentTransferEncoding()->getValue() on the parent part.
References vmime::fields::CONTENT_TRANSFER_ENCODING, vmime::dynamicCast(), bodyPart::getHeader(), and vmime::encodingTypes::SEVEN_BIT.
Referenced by body::generateImpl(), and body::getGeneratedSize().
|
virtual |
Get the number of bytes that will be used by this component when it is generated.
This may be a heuristically-derived estimate, but such an estimated size should always be larger than the actual generated size.
| ctx | generation context |
Reimplemented from component.
References vmime::dynamicCast(), text::FORCE_NO_ENCODING, encoding::getEncoder(), body::getEncoding(), body::getPartAt(), body::getPartCount(), and text::NO_NEW_LINE_SEQUENCE.
| shared_ptr< bodyPart > getPartAt | ( | const size_t | pos | ) |
Return the part at the specified position.
| pos | position |
References vmime::dynamicCast().
Referenced by body::generateImpl(), and body::getGeneratedSize().
Return the part at the specified position.
| pos | position |
References vmime::dynamicCast().
| size_t getPartCount | ( | ) | const |
Return the number of parts in the list.
Referenced by body::generateImpl(), and body::getGeneratedSize().
| const std::vector< shared_ptr< bodyPart > > getPartList | ( | ) |
Return the part list.
| const std::vector< shared_ptr< const bodyPart > > getPartList | ( | ) | const |
| void insertPartAfter | ( | const size_t | pos, |
| shared_ptr< bodyPart > | part | ||
| ) |
Insert a new part after the specified position.
| pos | position of the part before the new part |
| part | part to insert |
References vmime::dynamicCast().
| void insertPartAfter | ( | shared_ptr< bodyPart > | afterPart, |
| shared_ptr< bodyPart > | part | ||
| ) |
Insert a new part after the specified part.
| afterPart | part after which the new part will be inserted |
| part | part to insert |
| exceptions::no_such_part | if the part is not in the list |
References vmime::dynamicCast().
| void insertPartBefore | ( | const size_t | pos, |
| shared_ptr< bodyPart > | part | ||
| ) |
Insert a new part before the specified position.
| pos | position at which to insert the new part (0 to insert at the beginning of the list) |
| part | part to insert |
References vmime::dynamicCast().
| void insertPartBefore | ( | shared_ptr< bodyPart > | beforePart, |
| shared_ptr< bodyPart > | part | ||
| ) |
Insert a new part before the specified part.
| beforePart | part before which the new part will be inserted |
| part | part to insert |
| exceptions::no_such_part | if the part is not in the list |
References vmime::dynamicCast().
| bool isEmpty | ( | ) | const |
Tests whether the list of parts is empty.
Test a boundary string for validity (as defined in RFC #1521, page 19).
| boundary | boundary string to test |
References vmime::dynamicCast(), and vmime::end().
References body::copyFrom().
|
protectedvirtual |
Reimplemented from component.
References vmime::fields::CONTENT_TRANSFER_ENCODING, vmime::fields::CONTENT_TYPE, bodyPart::createChildPart(), vmime::dynamicCast(), vmime::end(), body::findNextBoundaryPosition(), bodyPart::getHeader(), mediaType::getType(), text::getWholeBuffer(), parserHelpers::isSpace(), parserHelpers::isSpaceOrTab(), vmime::mediaTypes::MULTIPART, vmime::npos, component::parse(), body::removeAllParts(), component::setParsedBounds(), and vmime::encodingTypes::SEVEN_BIT.
| void removeAllParts | ( | ) |
Remove all parts from the list.
Referenced by body::copyFrom(), and body::parseImpl().
Remove the part at the specified position.
| pos | position of the part to remove |
References vmime::dynamicCast().
| void removePart | ( | shared_ptr< bodyPart > | part | ) |
Remove the specified part from the list.
| part | part to remove |
| exceptions::no_such_part | if the part is not in the list |
References vmime::dynamicCast().
Set the charset of contents.
If the type is not set, it will be set to default "text/plain" type.
| chset | charset of contents |
References vmime::fields::CONTENT_TYPE, vmime::dynamicCast(), bodyPart::getHeader(), contentTypeField::setCharset(), body::setContentType(), vmime::mediaTypes::TEXT, and vmime::mediaTypes::TEXT_PLAIN.
| void setContents | ( | shared_ptr< const contentHandler > | contents | ) |
| void setContents | ( | shared_ptr< const contentHandler > | contents, |
| const mediaType & | type | ||
| ) |
Set the body contents and type.
| contents | new body contents |
| type | type of contents |
References vmime::dynamicCast(), and body::setContentType().
| void setContents | ( | shared_ptr< const contentHandler > | contents, |
| const mediaType & | type, | ||
| const charset & | chset | ||
| ) |
Set the body contents, type and charset.
| contents | new body contents |
| type | type of contents |
| chset | charset of contents |
References vmime::dynamicCast(), and body::setContentType().
| void setContents | ( | shared_ptr< const contentHandler > | contents, |
| const mediaType & | type, | ||
| const charset & | chset, | ||
| const encoding & | enc | ||
| ) |
Set the body contents, type, charset and encoding.
| contents | new body contents |
| type | type of contents |
| chset | charset of contents |
| enc | contents encoding |
References vmime::dynamicCast(), body::setContentType(), and body::setEncoding().
Set the MIME type of contents.
| type | MIME media type of contents |
References bodyPart::getHeader().
Set the MIME type and charset of contents.
If a charset is defined, it will not be modified.
| type | MIME media type of contents |
| chset | charset of contents |
References vmime::dynamicCast(), and bodyPart::getHeader().
Referenced by body::setCharset(), body::setContents(), body::setContents(), and body::setContents().
Set the output encoding of contents.
Contents will be encoded (or re-encoded) when this node is being generated.
| enc | encoding of contents |
References vmime::dynamicCast(), and bodyPart::getHeader().
Referenced by body::setContents().