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

The base class of the block class hierarchy. More...

#include <node.h>

+ Inheritance diagram for pstsdk::block:
+ Collaboration diagram for pstsdk::block:

Public Member Functions

 block (const shared_db_ptr &db, const block_info &info)
 Basic block constructor.
 
virtual ~block ()
 
virtual bool is_internal () const =0
 Returns the blocks internal/external state.
 
size_t get_disk_size () const
 Get the last known size of this block on disk.
 
block_id get_id () const
 Get the block_id of this block.
 
ulonglong get_address () const
 Get the address of this block on disk.
 

Protected Member Functions

shared_db_ptr get_db_ptr () const
 
virtual void trim ()
 

Protected Attributes

bool m_modified
 True if this block has been modified and needs to be saved.
 
size_t m_size
 The size of this specific block on disk at last save.
 
block_id m_id
 The id of this block.
 
ulonglong m_address
 The address of this specific block on disk, 0 if unknown.
 
weak_db_ptr m_db
 

Detailed Description

The base class of the block class hierarchy.

A block is an atomic unit of storage in a PST file. This class, and other classes in this hierarchy, are in memory representations of those blocks on disk. They are immutable, and are shared freely between different node instances as needed (via shared pointers). A block also knows how to read any blocks it may refer to (in the case of extended_block or a subnode_block).

All blocks in the block hierarchy are also in the category of what is known as dependant objects. This means is they only keep a weak reference to the database context to which they're a member. Contrast this to an independant object such as the node, which keeps a strong ref or a full shared_ptr to the related context. This implies that someone must externally make sure the database context outlives it's blocks - this is usually done by the database context itself or the node which holds these blocks.

See also
Block Structures
[MS-PST] 2.2.2.8

Definition at line 491 of file node.h.

Constructor & Destructor Documentation

◆ block()

pstsdk::block::block ( const shared_db_ptr db,
const block_info info 
)
inline

Basic block constructor.

Parameters
[in]dbThe database context this block was opened in
[in]infoInformation about this block

Definition at line 497 of file node.h.

◆ ~block()

virtual pstsdk::block::~block ( )
inlinevirtual

Definition at line 505 of file node.h.

Member Function Documentation

◆ get_address()

ulonglong pstsdk::block::get_address ( ) const
inline

Get the address of this block on disk.

Returns
The address of this block, 0 for a new block.

Definition at line 524 of file node.h.

◆ get_db_ptr()

shared_db_ptr pstsdk::block::get_db_ptr ( ) const
inlineprotected

Definition at line 532 of file node.h.

◆ get_disk_size()

size_t pstsdk::block::get_disk_size ( ) const
inline

Get the last known size of this block on disk.

Returns
The last known size of this block on disk

Definition at line 513 of file node.h.

◆ get_id()

block_id pstsdk::block::get_id ( ) const
inline

Get the block_id of this block.

Returns
The block_id of this block

Definition at line 520 of file node.h.

◆ is_internal()

virtual bool pstsdk::block::is_internal ( ) const
pure virtual

Returns the blocks internal/external state.

Returns
true if this is an internal block, false otherwise

Implemented in pstsdk::extended_block, pstsdk::external_block, and pstsdk::subnode_block.

◆ trim()

virtual void pstsdk::block::trim ( )
inlineprotectedvirtual

Definition at line 533 of file node.h.

Member Data Documentation

◆ m_address

ulonglong pstsdk::block::m_address
protected

The address of this specific block on disk, 0 if unknown.

Definition at line 538 of file node.h.

◆ m_db

weak_db_ptr pstsdk::block::m_db
protected

Definition at line 540 of file node.h.

◆ m_id

block_id pstsdk::block::m_id
protected

The id of this block.

Definition at line 537 of file node.h.

◆ m_modified

bool pstsdk::block::m_modified
protected

True if this block has been modified and needs to be saved.

Definition at line 535 of file node.h.

◆ m_size

size_t pstsdk::block::m_size
protected

The size of this specific block on disk at last save.

Definition at line 536 of file node.h.


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