Fairport  v1.0.38
fairport::attachment Class Reference

Encapsulates an attachment to a message. More...

#include <message.h>

List of all members.

Public Member Functions

std::wstring get_filename () const
 Get the filename of this attachment.
std::vector< byteget_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_bagget_property_bag ()
 Get the property bag backing this attachment.
const property_bagget_property_bag () const

Friends

class message
class contact
class attachment_transform

Detailed Description

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.

Definition at line 37 of file message.h.


Member Function Documentation

size_t fairport::attachment::content_size ( ) const [inline]

Read the size of the content in this attachment.

The size here is just for the binary data of the attachment.

Returns:
The size of the data stream of the attachment, in bytes

Definition at line 79 of file message.h.

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.

See also:
[MS-OXCMSG] 2.2.2.7
Returns:
A vector of bytes

Definition at line 52 of file message.h.

std::wstring fairport::attachment::get_filename ( ) const [inline]

Get the filename of this attachment.

See also:
[MS-OXCMSG] 2.2.2.10
[MS-OXCMSG] 2.2.2.11
Returns:
The filename

Definition at line 368 of file message.h.

property_bag& fairport::attachment::get_property_bag ( ) [inline]

Get the property bag backing this attachment.

Returns:
The property bag

Definition at line 97 of file message.h.

const property_bag& fairport::attachment::get_property_bag ( ) const [inline]

Get the property bag backing this attachment.

Returns:
The property bag

Definition at line 100 of file message.h.

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.

See also:
[MS-OXCMSG] 2.2.2.9
Returns:
true if this attachment is an attached message

Definition at line 87 of file message.h.

fairport::message fairport::attachment::open_as_message ( ) const [inline]

Interpret this attachment as a message.

Precondition:
is_message() == true
Returns:
A message object

Definition at line 380 of file message.h.

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.

See also:
[MS-OXCMSG] 2.2.2.7
Returns:
A stream device for the attachment data

Definition at line 64 of file message.h.

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.

See also:
attachment::content_size()
[MS-OXCMSG] 2.2.2.5
Returns:
The size of the attachment object, in bytes

Definition at line 73 of file message.h.


Friends And Related Function Documentation

friend class attachment_transform [friend]

Definition at line 107 of file message.h.

friend class contact [friend]

Definition at line 106 of file message.h.

friend class message [friend]

Definition at line 105 of file message.h.


The documentation for this class was generated from the following file: