PST File Format SDK v0.4
Loading...
Searching...
No Matches
pstsdk::attachment Class Reference

Encapsulates an attachment to a message. More...

#include <message.h>

+ Collaboration diagram for pstsdk::attachment:

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
 Get the property bag backing this attachment.
 

Friends

class message
 
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 36 of file message.h.

Member Function Documentation

◆ content_size()

size_t pstsdk::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 73 of file message.h.

◆ get_bytes()

std::vector< byte > pstsdk::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.

Returns
A vector of bytes

Definition at line 48 of file message.h.

◆ get_filename()

std::wstring pstsdk::attachment::get_filename ( ) const
inline

Get the filename of this attachment.

Returns
The filename

Definition at line 399 of file message.h.

◆ get_property_bag() [1/2]

property_bag & pstsdk::attachment::get_property_bag ( )
inline

Get the property bag backing this attachment.

Returns
The property bag

Definition at line 90 of file message.h.

◆ get_property_bag() [2/2]

const property_bag & pstsdk::attachment::get_property_bag ( ) const
inline

Get the property bag backing this attachment.

Returns
The property bag

Definition at line 93 of file message.h.

◆ is_message()

bool pstsdk::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.

Returns
true if this attachment is an attached message

Definition at line 80 of file message.h.

◆ open_as_message()

pstsdk::message pstsdk::attachment::open_as_message ( ) const
inline

Interpret this attachment as a message.

Precondition
is_message() == true
Returns
A message object

Definition at line 411 of file message.h.

◆ open_byte_stream()

hnid_stream_device pstsdk::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());
Encapsulates an attachment to a message.
Definition message.h:37
Contains references to other bth_node allocations.
Definition heap.h:364
boost::iostreams::stream< hnid_stream_device > prop_stream
The actual property stream, defined using the boost iostream library and the hnid_stream_device.
Definition object.h:81

Which can then be used as any iostream would be.

Returns
A stream device for the attachment data

Definition at line 59 of file message.h.

◆ size()

size_t pstsdk::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()
Returns
The size of the attachment object, in bytes

Definition at line 67 of file message.h.

Friends And Related Symbol Documentation

◆ attachment_transform

Definition at line 99 of file message.h.

◆ message

Definition at line 98 of file message.h.


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