Represents an mail attachment compatible with Be File System attributes. More...
Inherits BMailAttachment.
Public Member Functions | |
| BAttributedMailAttachment () | |
| Creates an uninitialized BAttributedMailAttachment object. | |
| BAttributedMailAttachment (BFile *file, bool delete_when_done) | |
| Creates and initializes an attachment object from a file. | |
| BAttributedMailAttachment (entry_ref *ref) | |
| Creates and initializes an attachment object from a filesystem entry. | |
| virtual | ~BAttributedMailAttachment () |
| Frees all resources associated with this object. | |
| virtual status_t | InitCheck () |
| Checks whether the object has been properly initialized or not. | |
| virtual status_t | MIMEType (BMimeType *mime) |
| Places the MIME type of the data into mime. | |
| virtual status_t | RenderToRFC822 (BPositionIO *render_to) |
| Renders the component into RFC-822 format. | |
| void | SaveToDisk (BEntry *entry) |
| Stores the attachment's decoded data in a temporary file on disk. | |
| virtual status_t | SetTo (BFile *file, bool delete_file_when_done=false) |
| Initializes the object to the specified file. | |
| virtual status_t | SetTo (entry_ref *ref) |
| Initializes the object to the specified entry_ref. | |
| virtual status_t | SetToRFC822 (BPositionIO *data, size_t length, bool parse_now=false) |
| Sets this object from a data stream in a RFC-822 compliant format. | |
Encoding | |
| void | SetEncoding (mail_encoding encoding) |
| Sets the Content-Transfer-Encoding header to encoding. | |
| mail_encoding | Encoding () |
| Returns the current Content-Transfer-Encoding header value. | |
Attachment's filename | |
| virtual status_t | FileName (char *name) |
| Returns the attachment's filename. | |
| virtual void | SetFileName (const char *name) |
| Changes the attachment's filename. | |
Attachment's data | |
| virtual status_t | GetDecodedData (BPositionIO *data) |
| Retrieves the attachment's decoded data with its attributes and writes them into data. | |
| virtual status_t | SetDecodedData (BPositionIO *data) |
| Sets the attachment's attributes and data to data. | |
| virtual status_t | InitCheck ()=0 |
| Pure virtual to check if the object was successfully initialized. | |
| virtual status_t | SetTo (BFile *file, bool deleteFileWhenDone=false)=0 |
| Pure virtual to initialize the object's attached file. | |
| virtual status_t | SetTo (entry_ref *ref)=0 |
| Pure virtual to initialize the object's attached file. | |
Attachment's filename | |
Public Member Functions inherited from BMailComponent | |
| BMailComponent (uint32 defaultCharSet=B_MAIL_NULL_CONVERSION) | |
| Initializes a new BMailComponent with the specified character set. | |
| virtual | ~BMailComponent () |
| Destructor. | |
| uint32 | ComponentType () |
Returns the component_type of this object. | |
| virtual status_t | GetDecodedData (BPositionIO *data) |
| Retrieves the data contained in this component in canonical format and places it into data. | |
| const char * | HeaderAt (int32 index) const |
Returns the key of the header at index. | |
| status_t | HeaderField (const char *key, BMessage *structured_header, int32 index=0) const |
| Returns the header key. | |
| const char * | HeaderField (const char *key, int32 index=0) const |
| Returns the header key. | |
| bool | IsAttachment () |
| Employs simple heuristics such as the MIME type and the Content-Disposition: header to determine whether this component is an attachment. | |
| virtual status_t | MIMEType (BMimeType *mime) |
| Places the MIME type of the data into mime. | |
| status_t | RemoveHeader (const char *key) |
| Removes all headers with the key key. | |
| virtual status_t | RenderToRFC822 (BPositionIO *render_to) |
| Renders the component into RFC-822 format. | |
| virtual status_t | SetDecodedData (BPositionIO *data) |
| Sets the content of this component to the canonical format data contained in data. | |
| void | SetHeaderField (const char *key, BMessage *structured_header, bool replace_existing=true) |
| Adds a structured header of type key to the component. | |
| void | SetHeaderField (const char *key, const char *value, uint32 charset=B_MAIL_NULL_CONVERSION, mail_encoding encoding=null_encoding, bool replace_existing=true) |
| Adds the specified header of type key and with the value to the component. | |
| virtual status_t | SetToRFC822 (BPositionIO *data, size_t length, bool parse_now=false) |
| Sets this object from a component in RFC-822 format. | |
| BMailComponent * | WhatIsThis () |
| Employs simple heuristics such as the MIME type to present you with an instance of a useful subclass. | |
Represents an mail attachment compatible with Be File System attributes.
This class builds a multipart container where the attached file is copied alongside its Be File System attributes, allowing to send or receive files without losing those filesystem attributes.
| BAttributedMailAttachment::BAttributedMailAttachment | ( | BFile * | file, |
| bool | delete_when_done | ||
| ) |
Creates and initializes an attachment object from a file.
| [in] | file | A file to be used for the attachment. |
| [in] | delete_when_done | Tells if the file has to be deleted when this object is destroyed. |
| BAttributedMailAttachment::BAttributedMailAttachment | ( | entry_ref * | ref | ) |
Creates and initializes an attachment object from a filesystem entry.
| [in] | ref | The filesystem entry from where to retrieve the attachment's data. |
| BAttributedMailAttachment::BAttributedMailAttachment | ( | ) |
Creates an uninitialized BAttributedMailAttachment object.
It can be later be initialized with either SetTo(BFile*, bool) or SetTo(entry_ref *).
|
virtual |
Frees all resources associated with this object.
| mail_encoding BAttributedMailAttachment::Encoding | ( | ) |
Returns the current Content-Transfer-Encoding header value.
|
virtual |
Returns the attachment's filename.
| [out] | name | A pre-allocated variable of B_FILE_NAME_LENGTH length where to write the filename. |
| B_OK | The filename was retrieved successfully. |
| B_NAME_NOT_FOUND | The filename could not be found. |
Implements BMailAttachment.
|
virtual |
Retrieves the attachment's decoded data with its attributes and writes them into data.
| [out] | data | A BPositionIO based data stream where to write the output data. |
| B_OK | The decoded data and attributes were retrieved successfully. |
| B_IO_ERROR | There is internally no data associated with this attachment. |
| B_BAD_VALUE | data is invalid. |
Reimplemented from BMailComponent.
|
virtual |
Checks whether the object has been properly initialized or not.
B_OK if the object has been properly initialized, or B_NO_INIT otherwise.Implements BMailAttachment.
Places the MIME type of the data into mime.
| [out] | mime | A pre-allocated BMimeType variable where to write the mimetype. |
Reimplemented from BMailComponent.
|
virtual |
Renders the component into RFC-822 format.
B_OK if everything was performed successfully, or an error code otherwise.Reimplemented from BMailComponent.
| void BAttributedMailAttachment::SaveToDisk | ( | BEntry * | entry | ) |
Stores the attachment's decoded data in a temporary file on disk.
The file path will be saved to entry.
| [out] | entry | A pre-allocated BEntry where to write the temporary file path. |
|
virtual |
Sets the attachment's attributes and data to data.
| [in] | data | The data stream from where the data and the attributes will be copied. |
| B_OK | No error. |
Reimplemented from BMailComponent.
| void BAttributedMailAttachment::SetEncoding | ( | mail_encoding | encoding | ) |
Sets the Content-Transfer-Encoding header to encoding.
|
virtual |
Changes the attachment's filename.
| [in] | name | The new filename string for the attachment. |
Implements BMailAttachment.
|
virtual |
Initializes the object to the specified file.
| [in] | file | A file to be used for the attachment. |
| [in] | delete_file_when_done | Tells if the file has to be deleted when this object is destroyed. |
B_OK on success or an error code otherwise.Implements BMailAttachment.
Initializes the object to the specified entry_ref.
| [in] | ref | An entry_ref for the attachment's data. |
B_OK on success or an error code otherwise.Implements BMailAttachment.
|
virtual |
Sets this object from a data stream in a RFC-822 compliant format.
Initializes this component to the RFC 822 format data in data, starting at data->Position(), for up to length bytes.
If parse_now is false, then the data will not be parsed until RenderToRFC822() is called.
| [in] | data | The data source. |
| [in] | length | The data's length. |
| [in] | parse_now | Whether the data will be parsed now or not. |
| B_OK | The operation was performed successfully. |
| B_BAD_TYPE | The underlying multipart container mimetype is invalid. |
| B_BAD_VALUE | The data and attributes are NULL. |
| B_NO_MEMORY | Not enough memory to decode the attachment's attributes. |
| B_IO_ERROR | Input/output error retrieving the attributes' data. |
Reimplemented from BMailComponent.