|
VMime
|


Public Member Functions | |
| body () | |
| ~body () | |
| void | appendPart (shared_ptr< bodyPart > part) |
| void | insertPartBefore (shared_ptr< bodyPart > beforePart, shared_ptr< bodyPart > part) |
| void | insertPartBefore (const size_t pos, shared_ptr< bodyPart > part) |
| void | insertPartAfter (shared_ptr< bodyPart > afterPart, shared_ptr< bodyPart > part) |
| void | insertPartAfter (const size_t pos, shared_ptr< bodyPart > part) |
| void | removePart (shared_ptr< bodyPart > part) |
| void | removePart (const size_t pos) |
| void | removeAllParts () |
| size_t | getPartCount () const |
| bool | isEmpty () const |
| shared_ptr< bodyPart > | getPartAt (const size_t pos) |
| const shared_ptr< const bodyPart > | getPartAt (const size_t pos) const |
| const std::vector< shared_ptr< const bodyPart > > | getPartList () const |
| const std::vector< shared_ptr< bodyPart > > | getPartList () |
| const string & | getPrologText () const |
| void | setPrologText (const string &prologText) |
| const string & | getEpilogText () const |
| void | setEpilogText (const string &epilogText) |
| const shared_ptr< const contentHandler > | getContents () const |
| void | setContents (shared_ptr< const contentHandler > contents) |
| void | setContents (shared_ptr< const contentHandler > contents, const mediaType &type) |
| void | setContents (shared_ptr< const contentHandler > contents, const mediaType &type, const charset &chset) |
| void | setContents (shared_ptr< const contentHandler > contents, const mediaType &type, const charset &chset, const encoding &enc) |
| void | setContentType (const mediaType &type, const charset &chset) |
| void | setContentType (const mediaType &type) |
| const mediaType | getContentType () const |
| void | setCharset (const charset &chset) |
| const charset | getCharset () const |
| void | setEncoding (const encoding &enc) |
| const encoding | getEncoding () const |
| shared_ptr< component > | clone () const |
| void | copyFrom (const component &other) |
| body & | operator= (const body &other) |
| const std::vector< shared_ptr< component > > | getChildComponents () |
| size_t | getGeneratedSize (const generationContext &ctx) |
Public Member Functions inherited from component | |
| component () | |
| virtual | ~component () |
| void | parse (const string &buffer) |
| void | parse (const parsingContext &ctx, const string &buffer) |
| void | parse (shared_ptr< utility::inputStream > inputStream, const size_t length) |
| void | parse (const string &buffer, const size_t position, const size_t end, size_t *newPosition=NULL) |
| void | parse (const parsingContext &ctx, const string &buffer, const size_t position, const size_t end, size_t *newPosition=NULL) |
| void | parse (shared_ptr< utility::inputStream > inputStream, const size_t position, const size_t end, size_t *newPosition=NULL) |
| void | parse (const parsingContext &ctx, shared_ptr< utility::inputStream > inputStream, const size_t position, const size_t end, size_t *newPosition=NULL) |
| virtual const string | generate (const size_t maxLineLength=lineLengthLimits::infinite, const size_t curLinePos=0) const |
| virtual void | generate (utility::outputStream &outputStream, const size_t curLinePos=0, size_t *newLinePos=NULL) const |
| virtual void | generate (const generationContext &ctx, utility::outputStream &outputStream, const size_t curLinePos=0, size_t *newLinePos=NULL) const |
| size_t | getParsedOffset () const |
| size_t | getParsedLength () const |
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 | ( | ) |
References body::findNextBoundaryPosition().
| void appendPart | ( | shared_ptr< bodyPart > | part | ) |
Add a part at the end of the list.
| part | part to append |
|
virtual |
|
virtual |
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(), body::getPartAt(), body::getPartCount(), 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::npos, and body::parseImpl().
Referenced by body::parseImpl(), and body::~body().
|
protectedvirtual |
Implements component.
References vmime::fields::CONTENT_TYPE, vmime::CRLF, text::encodeAndFold(), text::FORCE_NO_ENCODING, body::generateRandomBoundaryString(), contentTypeField::getBoundary(), body::getContentType(), body::getEncoding(), bodyPart::getHeader(), generationContext::getMaxLineLength(), body::getPartAt(), body::getPartCount(), text::isEmpty(), and text::NO_NEW_LINE_SEQUENCE.
Referenced by body::parseImpl().
|
static |
Generate a new random boundary string.
References random::getNext(), and random::getTime().
Referenced by body::generateImpl(), and body::setContents().
| const charset getCharset | ( | ) | const |
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, 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.
| const mediaType getContentType | ( | ) | const |
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, bodyPart::getHeader(), headerField::getValue(), vmime::mediaTypes::TEXT, and vmime::mediaTypes::TEXT_PLAIN.
Referenced by body::generateImpl().
| const encoding getEncoding | ( | ) | const |
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, bodyPart::getHeader(), bodyPart::getParentPart(), bodyPart::importChildPart(), and vmime::encodingTypes::SEVEN_BIT.
Referenced by body::generateImpl(), and body::getGeneratedSize().
| const string & getEpilogText | ( | ) | const |
Return the epilog text.
|
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 text::encodeAndFold(), text::FORCE_NO_ENCODING, encoding::getEncoder(), body::getEncoding(), body::getPartAt(), body::getPartCount(), text::isEmpty(), and text::NO_NEW_LINE_SEQUENCE.
Return the part at the specified position.
| pos | position |
Referenced by body::copyFrom(), body::generateImpl(), and body::getGeneratedSize().
Return the part at the specified position.
| pos | position |
| size_t getPartCount | ( | ) | const |
Return the number of parts in the list.
Referenced by body::copyFrom(), body::generateImpl(), and body::getGeneratedSize().
| const std::vector< shared_ptr< const bodyPart > > getPartList | ( | ) | const |
Return the part list.
| const std::vector< shared_ptr< bodyPart > > getPartList | ( | ) |
Return the part list.
| const string & getPrologText | ( | ) | const |
Return the prolog text.
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 |
Insert a new part after the specified position.
| pos | position of the part before the new part |
| part | part to insert |
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 |
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 |
| bool isEmpty | ( | ) | const |
Tests whether the list of parts is empty.
|
static |
Test a boundary string for validity (as defined in RFC #1521, page 19).
| boundary | boundary string to test |
References vmime::end(), and vmime::npos.
Referenced by body::setContents().
References body::copyFrom().
|
protectedvirtual |
Reimplemented from component.
References vmime::fields::CONTENT_TRANSFER_ENCODING, vmime::fields::CONTENT_TYPE, bodyPart::createChildPart(), vmime::end(), body::findNextBoundaryPosition(), body::generateImpl(), generationContext::getEpilogText(), bodyPart::getHeader(), generationContext::getPrologText(), mediaType::getType(), text::getWholeBuffer(), parserHelpers::isSpace(), parserHelpers::isSpaceOrTab(), vmime::mediaTypes::MULTIPART, vmime::npos, vmime::NULL_STRING, component::parse(), body::removeAllParts(), component::setParsedBounds(), and vmime::encodingTypes::SEVEN_BIT.
Referenced by body::findNextBoundaryPosition().
| void removeAllParts | ( | ) |
Remove all parts from the list.
Referenced by body::copyFrom(), and body::parseImpl().
| 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 |
| void removePart | ( | const size_t | pos | ) |
Remove the part at the specified position.
| pos | position of the part to remove |
| void setCharset | ( | const charset & | chset | ) |
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, bodyPart::getHeader(), contentTypeField::setCharset(), body::setContentType(), vmime::mediaTypes::TEXT, and vmime::mediaTypes::TEXT_PLAIN.
| void setContents | ( | shared_ptr< const contentHandler > | contents | ) |
Set the body contents.
| contents | new body 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 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 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::fields::CONTENT_TYPE, body::generateRandomBoundaryString(), contentTypeField::getBoundary(), bodyPart::getHeader(), mediaType::getType(), bodyPart::importChildPart(), body::isValidBoundary(), vmime::mediaTypes::MULTIPART, vmime::mediaTypes::MULTIPART_MIXED, body::setContentType(), body::setEncoding(), and headerField::setValue().
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 bodyPart::getHeader().
Referenced by body::setCharset(), and body::setContents().
| void setContentType | ( | const mediaType & | type | ) |
Set the MIME type of contents.
| type | MIME media type of contents |
References bodyPart::getHeader().
| void setEncoding | ( | const encoding & | enc | ) |
Set the output encoding of contents.
Contents will be encoded (or re-encoded) when this node is being generated.
| enc | encoding of contents |
References bodyPart::getHeader().
Referenced by body::setContents().
| void setEpilogText | ( | const string & | epilogText | ) |
Set the epilog text.
| epilogText | new epilog text |
| void setPrologText | ( | const string & | prologText | ) |
Set the prolog text.
| prologText | new prolog text |