PST File Format SDK v0.4
Loading...
Searching...
No Matches
pstsdk::basic_table< T > Class Template Reference

Implementation of an ANSI TC (64k rows) and a unicode TC. More...

#include <table.h>

+ Inheritance diagram for pstsdk::basic_table< T >:
+ Collaboration diagram for pstsdk::basic_table< T >:

Public Member Functions

nodeget_node ()
 Get the node backing this table.
 
const nodeget_node () const
 Get the node backing this table.
 
ulong lookup_row (row_id id) const
 Find the offset into the table of the given row_id.
 
ulonglong get_cell_value (ulong row, prop_id id) const
 Get the contents of the specified cell in the specified row.
 
std::vector< byteread_cell (ulong row, prop_id id) const
 Get the contents of a indirect property in the specified row.
 
hnid_stream_device open_cell_stream (ulong row, prop_id id)
 Open a stream over a property in a given row.
 
std::vector< prop_idget_prop_list () const
 Get all of the properties on this table.
 
prop_type get_prop_type (prop_id id) const
 Get the type of a property.
 
row_id get_row_id (ulong row) const
 Get the row id of a specified row.
 
size_t size () const
 Get the number of rows in this table.
 
bool prop_exists (ulong row, prop_id id) const
 Check to see if a property exists for a given row.
 
size_t row_prop_size (ulong row, prop_id id) const
 Return the size of a property for a given row.
 
- Public Member Functions inherited from pstsdk::table_impl
virtual ~table_impl ()
 
const_table_row operator[] (ulong row) const
 Get the requested table row.
 
const_table_row_iter begin () const
 Get an iterator pointing to the first row.
 
const_table_row_iter end () const
 Get an end iterator for this table.
 

Friends

table_ptr open_table (const node &n)
 Open the specified node as a table.
 
table_ptr open_table (const node &n, alias_tag)
 Open the specified node as a table.
 

Detailed Description

template<typename T>
class pstsdk::basic_table< T >

Implementation of an ANSI TC (64k rows) and a unicode TC.

ANSI and Unicode TCs differ in the "row index" BTH. On an ANSI PST the type type is 2 bytes and in Unicode PSTs the value type is 4 bytes. Since the value type is the row offset for a given row_id, that implies a 64k row limit for TCs in ANSI stores.

Note that the information about the key/value size is stored in the BTH header. We use that to determine what type of table this is, rather than trying to figure out if we're opened over an ANSI or Unicode PST (which has been abstracted away from us at this point).

Template Parameters
TThe size of the value type in the row index BTH - ushort for an ANSI table, ulong for a Unicode table
See also
[MS-PST] 2.3.4.3.1/dwRowIndex

Definition at line 236 of file table.h.

Member Function Documentation

◆ get_cell_value()

template<typename T >
pstsdk::ulonglong pstsdk::basic_table< T >::get_cell_value ( ulong  row,
prop_id  id 
) const
inlinevirtual

Get the contents of the specified cell in the specified row.

Exceptions
key_not_found<prop_id>If the specified property does not exist on the specified row
out_of_rangeIf the specified row offset is beyond the size of this table
Parameters
[in]rowThe offset into the table
[in]idThe prop_id to find the cell value of
Returns
The cell value

Implements pstsdk::table_impl.

Definition at line 578 of file table.h.

◆ get_node() [1/2]

template<typename T >
node & pstsdk::basic_table< T >::get_node ( )
inlinevirtual

Get the node backing this table.

Returns
The node

Implements pstsdk::table_impl.

Definition at line 239 of file table.h.

◆ get_node() [2/2]

template<typename T >
const node & pstsdk::basic_table< T >::get_node ( ) const
inlinevirtual

Get the node backing this table.

Returns
The node

Implements pstsdk::table_impl.

Definition at line 241 of file table.h.

◆ get_prop_list()

template<typename T >
std::vector< pstsdk::prop_id > pstsdk::basic_table< T >::get_prop_list ( ) const
inlinevirtual

Get all of the properties on this table.

This returns the properties behind all of the columns which make up this table. This doesn't imply that every property is present on every row, however.

Returns
A vector all of the column prop_ids

Implements pstsdk::table_impl.

Definition at line 554 of file table.h.

◆ get_prop_type()

template<typename T >
pstsdk::prop_type pstsdk::basic_table< T >::get_prop_type ( prop_id  id) const
inlinevirtual

Get the type of a property.

Returns
The property type

Implements pstsdk::table_impl.

Definition at line 649 of file table.h.

◆ get_row_id()

template<typename T >
pstsdk::row_id pstsdk::basic_table< T >::get_row_id ( ulong  row) const
inlinevirtual

Get the row id of a specified row.

On disk, the first DWORD is always the row_id.

See also
[MS-PST] 2.3.4.4.1/dwRowID
Returns
The row id

Implements pstsdk::table_impl.

Definition at line 660 of file table.h.

◆ lookup_row()

template<typename T >
pstsdk::ulong pstsdk::basic_table< T >::lookup_row ( row_id  id) const
inlinevirtual

Find the offset into the table of the given row_id.

Exceptions
key_not_found<row_id>If the given row_id is not present in this table
Parameters
[in]idThe row id to lookup
Returns
The offset into the table

Implements pstsdk::table_impl.

Definition at line 565 of file table.h.

◆ open_cell_stream()

template<typename T >
pstsdk::hnid_stream_device pstsdk::basic_table< T >::open_cell_stream ( ulong  row,
prop_id  id 
)
inlinevirtual

Open a stream over a property in a given row.

Exceptions
key_not_found<prop_id>If the specified property does not exist on the specified row
out_of_rangeIf the specified row offset is beyond the size of this table
Note
This operation is only valid for variable length properties
Parameters
[in]rowThe offset into the table
[in]idThe prop_id to find the cell value of
Returns
A device which can be used to construct a stream object

Implements pstsdk::table_impl.

Definition at line 638 of file table.h.

◆ prop_exists()

template<typename T >
bool pstsdk::basic_table< T >::prop_exists ( ulong  row,
prop_id  id 
) const
inlinevirtual

Check to see if a property exists for a given row.

Parameters
[in]rowThe offset into the table
[in]idThe prop_id
Returns
true if the property exists

Implements pstsdk::table_impl.

Definition at line 711 of file table.h.

◆ read_cell()

template<typename T >
std::vector< pstsdk::byte > pstsdk::basic_table< T >::read_cell ( ulong  row,
prop_id  id 
) const
inlinevirtual

Get the contents of a indirect property in the specified row.

Exceptions
key_not_found<prop_id>If the specified property does not exist on the specified row
out_of_rangeIf the specified row offset is beyond the size of this table
Parameters
[in]rowThe offset into the table
[in]idThe prop_id to find the cell value of
Returns
The raw bytes of the property

Implements pstsdk::table_impl.

Definition at line 619 of file table.h.

◆ row_prop_size()

template<typename T >
size_t pstsdk::basic_table< T >::row_prop_size ( ulong  row,
prop_id  id 
) const
inlinevirtual

Return the size of a property for a given row.

Note
This operation is only valid for variable length properties
Parameters
[in]rowThe offset into the table
[in]idThe prop_id
Returns
The vector.size() if read_prop were called

Implements pstsdk::table_impl.

Definition at line 608 of file table.h.

◆ size()

template<typename T >
size_t pstsdk::basic_table< T >::size ( ) const
inlinevirtual

Get the number of rows in this table.

Returns
The number of rows

Implements pstsdk::table_impl.

Definition at line 541 of file table.h.

Friends And Related Symbol Documentation

◆ open_table [1/2]

template<typename T >
table_ptr open_table ( const node n)
friend

Open the specified node as a table.

Parameters
[in]nThe node to copy and interpret as a TC

◆ open_table [2/2]

template<typename T >
table_ptr open_table ( const node n,
alias_tag   
)
friend

Open the specified node as a table.

Parameters
[in]nThe node to alias and interpret as a TC

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