Fairport
v1.0.38
|
Encapsulates an attachment to a message. More...
#include <message.h>
Public Member Functions | |
std::wstring | get_filename () const |
Get the filename of this attachment. | |
std::vector< byte > | get_bytes () const |
Get the attachment data, as a blob. | |
hnid_stream_device | open_byte_stream () |
Open a stream of the attachment data. | |
size_t | size () const |
Read the size of this attachment. | |
size_t | content_size () const |
Read the size of the content in this attachment. | |
bool | is_message () const |
Returns if this attachment is actually an embedded message. | |
message | open_as_message () const |
Interpret this attachment as a message. | |
property_bag & | get_property_bag () |
Get the property bag backing this attachment. | |
const property_bag & | get_property_bag () const |
Friends | |
class | message |
class | contact |
class | attachment_transform |
Encapsulates an attachment to a message.
Attachment objects allow you to query for some basic information about an attachment, get access to the bytes of the attachment (as a blob or stream), as well as open the attachment as a message if applicable.
size_t fairport::attachment::content_size | ( | ) | const [inline] |
std::vector<byte> fairport::attachment::get_bytes | ( | ) | const [inline] |
Get the attachment data, as a blob.
You might want to consider open_byte_stream if content_size() is too large for your tastes.
std::wstring fairport::attachment::get_filename | ( | ) | const [inline] |
property_bag& fairport::attachment::get_property_bag | ( | ) | [inline] |
const property_bag& fairport::attachment::get_property_bag | ( | ) | const [inline] |
bool fairport::attachment::is_message | ( | ) | const [inline] |
Returns if this attachment is actually an embedded message.
If an attachment is a message, one should use open_as_message() to access the data rather than open_byte_stream() or similar.
fairport::message fairport::attachment::open_as_message | ( | ) | const [inline] |
hnid_stream_device fairport::attachment::open_byte_stream | ( | ) | [inline] |
Open a stream of the attachment data.
The returned stream device can be used to construct a proper stream:
attachment a = ...; prop_stream nstream(a.open_byte_stream());
Which can then be used as any iostream would be.
size_t fairport::attachment::size | ( | ) | const [inline] |
Read the size of this attachment.
The size returned here includes metadata, and as such will be larger than just the byte stream.
friend class attachment_transform [friend] |