PST File Format SDK v0.4
Loading...
Searching...
No Matches
pstsdk::const_property_object Class Referenceabstract

Property object base class. More...

#include <object.h>

+ Inheritance diagram for pstsdk::const_property_object:
+ Collaboration diagram for pstsdk::const_property_object:

Public Member Functions

virtual ~const_property_object ()
 
virtual std::vector< prop_idget_prop_list () const =0
 Get a list of all properties on this object.
 
virtual prop_type get_prop_type (prop_id id) const =0
 Get the property type of a given prop_id.
 
virtual bool prop_exists (prop_id id) const =0
 Indicates the existance of a given property on this object.
 
virtual size_t size (prop_id id) const =0
 Returns the total size of a variable length property.
 
template<typename T >
read_prop (prop_id id) const
 Read a property as a given type.
 
template<typename T >
std::optional< T > read_prop_if_exists (prop_id id) const
 Read a property as a given type, if it exists.
 
template<typename T >
std::vector< T > read_prop_array (prop_id id) const
 Read a property as an array of the given type.
 
virtual hnid_stream_device open_prop_stream (prop_id id)=0
 Creates a stream device over a property on this object.
 
template<>
bool read_prop (prop_id id) const
 
template<>
std::vector< bool > read_prop_array (prop_id id) const
 
template<>
time_t read_prop (prop_id id) const
 
template<>
std::vector< time_tread_prop_array (prop_id id) const
 

Protected Member Functions

virtual byte get_value_1 (prop_id id) const =0
 Implemented by child classes to fetch a 1 byte sized property.
 
virtual ushort get_value_2 (prop_id id) const =0
 Implemented by child classes to fetch a 2 byte sized property.
 
virtual ulong get_value_4 (prop_id id) const =0
 Implemented by child classes to fetch a 4 byte sized property.
 
virtual ulonglong get_value_8 (prop_id id) const =0
 Implemented by child classes to fetch a 8 byte sized property.
 
virtual std::vector< byteget_value_variable (prop_id id) const =0
 Implemented by child classes to fetch a variable sized property.
 

Detailed Description

Property object base class.

This class provides a simple interface (using templates) to access properties on an object. It defines a handful of virtual functions child classes implement to read the raw data.

This class is contains all the conversion logic between the different types, implemented as template specializations, and other property logic such as multivalued property parsing.

Definition at line 93 of file object.h.

Constructor & Destructor Documentation

◆ ~const_property_object()

virtual pstsdk::const_property_object::~const_property_object ( )
inlinevirtual

Definition at line 96 of file object.h.

Member Function Documentation

◆ get_prop_list()

virtual std::vector< prop_id > pstsdk::const_property_object::get_prop_list ( ) const
pure virtual

Get a list of all properties on this object.

Returns
A vector of all properties on this object

Implemented in pstsdk::property_bag, and pstsdk::const_table_row.

◆ get_prop_type()

virtual prop_type pstsdk::const_property_object::get_prop_type ( prop_id  id) const
pure virtual

Get the property type of a given prop_id.

Parameters
[in]idThe prop_id
Exceptions
key_not_found<prop_id>If the specified property is not present
Returns
The type of the prop_id

Implemented in pstsdk::property_bag, and pstsdk::const_table_row.

◆ get_value_1()

virtual byte pstsdk::const_property_object::get_value_1 ( prop_id  id) const
protectedpure virtual

Implemented by child classes to fetch a 1 byte sized property.

◆ get_value_2()

virtual ushort pstsdk::const_property_object::get_value_2 ( prop_id  id) const
protectedpure virtual

Implemented by child classes to fetch a 2 byte sized property.

◆ get_value_4()

virtual ulong pstsdk::const_property_object::get_value_4 ( prop_id  id) const
protectedpure virtual

Implemented by child classes to fetch a 4 byte sized property.

◆ get_value_8()

virtual ulonglong pstsdk::const_property_object::get_value_8 ( prop_id  id) const
protectedpure virtual

Implemented by child classes to fetch a 8 byte sized property.

◆ get_value_variable()

virtual std::vector< byte > pstsdk::const_property_object::get_value_variable ( prop_id  id) const
protectedpure virtual

Implemented by child classes to fetch a variable sized property.

Implemented in pstsdk::property_bag.

◆ open_prop_stream()

virtual hnid_stream_device pstsdk::const_property_object::open_prop_stream ( prop_id  id)
pure virtual

Creates a stream device over a property on this object.

The returned stream device can be used to construct a proper stream:

prop_stream nstream(po->open_prop_stream(0x3001));
Contains references to other bth_node allocations.
Definition heap.h:364
Property object base class.
Definition object.h:94
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.

Note
This is operation is only valid for variable length properties
Parameters
[in]idThe prop_id
Exceptions
key_not_found<prop_id>If the specified property is not present
Returns
A stream device for the requested property

Implemented in pstsdk::property_bag, and pstsdk::const_table_row.

◆ prop_exists()

virtual bool pstsdk::const_property_object::prop_exists ( prop_id  id) const
pure virtual

Indicates the existance of a given property on this object.

Parameters
[in]idThe prop_id
Returns
true if the property exists

Implemented in pstsdk::property_bag, and pstsdk::const_table_row.

◆ read_prop() [1/3]

template<typename T >
T pstsdk::const_property_object::read_prop ( prop_id  id) const
inline

Read a property as a given type.

It is the callers responsibility to ensure the prop_id is of or convertable to the requested type.

Template Parameters
TThe type to interpret he property as
Parameters
[in]idThe prop_id
Exceptions
key_not_found<prop_id>If the specified property is not present
Returns
The property value

Definition at line 188 of file object.h.

◆ read_prop() [2/3]

template<>
bool pstsdk::const_property_object::read_prop ( prop_id  id) const
inline

Definition at line 240 of file object.h.

◆ read_prop() [3/3]

template<>
time_t pstsdk::const_property_object::read_prop ( prop_id  id) const
inline

Definition at line 262 of file object.h.

◆ read_prop_array() [1/3]

template<typename T >
std::vector< T > pstsdk::const_property_object::read_prop_array ( prop_id  id) const
inline

Read a property as an array of the given type.

It is the callers responsibility to ensure the prop_id is of or convertable to the requested type.

Template Parameters
TThe type to interpret he property as
Parameters
[in]idThe prop_id
Exceptions
key_not_found<prop_id>If the specified property is not present
Returns
A vector of the property values
See also
[MS-PST] 2.3.3.4

Definition at line 224 of file object.h.

◆ read_prop_array() [2/3]

template<>
std::vector< bool > pstsdk::const_property_object::read_prop_array ( prop_id  id) const
inline

Definition at line 240 of file object.h.

◆ read_prop_array() [3/3]

template<>
std::vector< time_t > pstsdk::const_property_object::read_prop_array ( prop_id  id) const
inline

Definition at line 262 of file object.h.

◆ read_prop_if_exists()

template<typename T >
std::optional< T > pstsdk::const_property_object::read_prop_if_exists ( prop_id  id) const

Read a property as a given type, if it exists.

It is the callers responsibility to ensure the prop_id is of or convertable to the requested type.

Template Parameters
TThe type to interpret he property as
Parameters
[in]idThe prop_id
Exceptions
key_not_found<prop_id>If the specified property is not present
Returns
The property value

Definition at line 309 of file object.h.

◆ size()

virtual size_t pstsdk::const_property_object::size ( prop_id  id) const
pure virtual

Returns the total size of a variable length property.

Note
This operation is only valid for variable length properties
Parameters
[in]idThe prop_id
Returns
The vector.size() if read_prop was called for this prop

Implemented in pstsdk::property_bag, and pstsdk::const_table_row.


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