|
VMime
|
#include <body.hpp>


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 | ( | ) |
Referenced by bodyPart, copyFrom(), and operator=().
| ~body | ( | ) |
| void appendPart | ( | shared_ptr< bodyPart > | part | ) |
|
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 body(), component::component(), getPartAt(), getPartCount(), and removeAllParts().
Referenced by bodyPart, and 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::end(), and vmime::npos.
Referenced by bodyPart, and parseImpl().
|
protectedvirtual |
Implements component.
References vmime::fields::CONTENT_TYPE, vmime::CRLF, text::encodeAndFold(), text::FORCE_NO_ENCODING, generateRandomBoundaryString(), getContentType(), getEncoding(), generationContext::getMaxLineLength(), getPartAt(), getPartCount(), text::isEmpty(), and text::NO_NEW_LINE_SEQUENCE.
Referenced by bodyPart.
|
static |
Generate a new random boundary string.
References random::getNext(), and random::getTime().
Referenced by bodyPart, and generateImpl().
| 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, and vmime::charsets::US_ASCII.
Referenced by bodyPart.
|
virtual |
Return the list of children of this component.
Implements component.
References vmime::copy_vector().
Referenced by bodyPart.
| const shared_ptr< const contentHandler > getContents | ( | ) | const |
Return a read-only reference to body contents.
Referenced by bodyPart.
| 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, vmime::mediaTypes::TEXT, and vmime::mediaTypes::TEXT_PLAIN.
Referenced by bodyPart, and 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, and vmime::encodingTypes::SEVEN_BIT.
Referenced by bodyPart, generateImpl(), and getGeneratedSize().
| const string & getEpilogText | ( | ) | const |
|
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(), getEncoding(), getPartAt(), getPartCount(), text::isEmpty(), and text::NO_NEW_LINE_SEQUENCE.
Referenced by bodyPart.
Return the part at the specified position.
| pos | position |
Referenced by bodyPart, copyFrom(), generateImpl(), and getGeneratedSize().
Return the part at the specified position.
| pos | position |
| size_t getPartCount | ( | ) | const |
Return the number of parts in the list.
Referenced by bodyPart, copyFrom(), generateImpl(), and getGeneratedSize().
| const std::vector< shared_ptr< bodyPart > > getPartList | ( | ) |
Return the part list.
| const std::vector< shared_ptr< const bodyPart > > getPartList | ( | ) | const |
| const string & getPrologText | ( | ) | const |
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 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 |
Referenced by bodyPart.
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 |
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 |
Referenced by bodyPart.
| bool isEmpty | ( | ) | const |
Tests whether the list of parts is empty.
Referenced by bodyPart.
|
static |
Test a boundary string for validity (as defined in RFC #1521, page 19).
| boundary | boundary string to test |
References vmime::end().
Referenced by bodyPart.
References body(), and copyFrom().
Referenced by bodyPart.
|
protectedvirtual |
Reimplemented from component.
References vmime::fields::CONTENT_TRANSFER_ENCODING, vmime::fields::CONTENT_TYPE, vmime::end(), findNextBoundaryPosition(), mediaType::getType(), text::getWholeBuffer(), parserHelpers::isSpace(), parserHelpers::isSpaceOrTab(), vmime::mediaTypes::MULTIPART, vmime::npos, component::parse(), removeAllParts(), component::setParsedBounds(), and vmime::encodingTypes::SEVEN_BIT.
Referenced by bodyPart.
| void removeAllParts | ( | ) |
Remove all parts from the list.
Referenced by bodyPart, copyFrom(), and parseImpl().
| void removePart | ( | const size_t | pos | ) |
Remove the part at the specified position.
| pos | position of the part to remove |
| 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 |
Referenced by bodyPart.
| 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, setContentType(), vmime::mediaTypes::TEXT, and vmime::mediaTypes::TEXT_PLAIN.
Referenced by bodyPart.
| 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 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 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 setContentType(), and setEncoding().
| void setContentType | ( | const mediaType & | type | ) |
Set the MIME type of contents.
| type | MIME media type of contents |
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().
Referenced by bodyPart, setCharset(), setContents(), setContents(), and setContents().
| 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 headerField::setValue().
Referenced by bodyPart, and setContents().
| void setEpilogText | ( | const string & | epilogText | ) |
| void setPrologText | ( | const string & | prologText | ) |