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

PST implementation. More...

#include <database.h>

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

Public Member Functions

template<typename K , typename V >
std::shared_ptr< pstsdk::bt_nonleaf_page< K, V > > read_bt_nonleaf_page (const page_info &pi, pstsdk::disk::bt_page< T, disk::bt_entry< T > > &the_page)
 
Lookup functions
node lookup_node (node_id nid)
 Open a node.
 
node_info lookup_node_info (node_id nid)
 Lookup information about a node.
 
block_info lookup_block_info (block_id bid)
 Lookup information about a block.
 
Page factory functions
std::shared_ptr< bbt_pageread_bbt_root ()
 Get the root of the BBT of this context.
 
std::shared_ptr< nbt_pageread_nbt_root ()
 Get the root of the NBT of this context.
 
std::shared_ptr< bbt_pageread_bbt_page (const page_info &pi)
 Open a BBT page.
 
std::shared_ptr< nbt_pageread_nbt_page (const page_info &pi)
 Open a NBT page.
 
std::shared_ptr< nbt_leaf_pageread_nbt_leaf_page (const page_info &pi)
 Open a NBT leaf page.
 
std::shared_ptr< bbt_leaf_pageread_bbt_leaf_page (const page_info &pi)
 Open a BBT leaf page.
 
std::shared_ptr< nbt_nonleaf_pageread_nbt_nonleaf_page (const page_info &pi)
 Open a NBT nonleaf page.
 
std::shared_ptr< bbt_nonleaf_pageread_bbt_nonleaf_page (const page_info &pi)
 Open a BBT nonleaf page.
 
- Public Member Functions inherited from pstsdk::db_context
virtual ~db_context ()
 
std::shared_ptr< blockread_block (block_id bid)
 Open a block in this context.
 
std::shared_ptr< data_blockread_data_block (block_id bid)
 Open a data_block in this context.
 
std::shared_ptr< extended_blockread_extended_block (block_id bid)
 Open a extended_block in this context.
 
std::shared_ptr< external_blockread_external_block (block_id bid)
 Open a external_block in this context.
 
std::shared_ptr< subnode_blockread_subnode_block (block_id bid)
 Open a subnode_block in this context.
 
std::shared_ptr< subnode_leaf_blockread_subnode_leaf_block (block_id bid)
 Open a subnode_leaf_block in this context.
 
std::shared_ptr< subnode_nonleaf_blockread_subnode_nonleaf_block (block_id bid)
 Open a subnode_nonleaf_block in this context.
 
std::shared_ptr< blockread_block (const block_info &bi)
 Open a block in this context.
 
std::shared_ptr< data_blockread_data_block (const block_info &bi)
 Open a data_block in this context.
 
std::shared_ptr< extended_blockread_extended_block (const block_info &bi)
 Open a extended_block in this context.
 
std::shared_ptr< external_blockread_external_block (const block_info &bi)
 Open a block in this context.
 
std::shared_ptr< subnode_blockread_subnode_block (const block_info &bi)
 Open a subnode_block in this context.
 
std::shared_ptr< subnode_leaf_blockread_subnode_leaf_block (const block_info &bi)
 Open a subnode_leaf_block in this context.
 
std::shared_ptr< subnode_nonleaf_blockread_subnode_nonleaf_block (const block_info &bi)
 Open a subnode_nonleaf_block in this context.
 

Block factory functions

std::shared_ptr< filem_file
 
disk::header< T > m_header
 
std::shared_ptr< bbt_pagem_bbt_root
 
std::shared_ptr< nbt_pagem_nbt_root
 
std::shared_ptr< blockread_block (const shared_db_ptr &parent, block_id bid)
 Open a block in the specified context.
 
std::shared_ptr< data_blockread_data_block (const shared_db_ptr &parent, block_id bid)
 Open a data_block in the specified context.
 
std::shared_ptr< extended_blockread_extended_block (const shared_db_ptr &parent, block_id bid)
 Open an extended_block in the specified context.
 
std::shared_ptr< external_blockread_external_block (const shared_db_ptr &parent, block_id bid)
 Open a external_block in the specified context.
 
std::shared_ptr< subnode_blockread_subnode_block (const shared_db_ptr &parent, block_id bid)
 Open a subnode_block in the specified context.
 
std::shared_ptr< subnode_leaf_blockread_subnode_leaf_block (const shared_db_ptr &parent, block_id bid)
 Open a subnode_leaf_block in the specified context.
 
std::shared_ptr< subnode_nonleaf_blockread_subnode_nonleaf_block (const shared_db_ptr &parent, block_id bid)
 Open a subnode_nonleaf_block in the specified context.
 
std::shared_ptr< blockread_block (const shared_db_ptr &parent, const block_info &bi)
 Open a block in the specified context.
 
std::shared_ptr< data_blockread_data_block (const shared_db_ptr &parent, const block_info &bi)
 Open a data_block in the specified context.
 
std::shared_ptr< extended_blockread_extended_block (const shared_db_ptr &parent, const block_info &bi)
 Open a extended_block in the specified context.
 
std::shared_ptr< external_blockread_external_block (const shared_db_ptr &parent, const block_info &bi)
 Open a external_block in the specified context.
 
std::shared_ptr< subnode_blockread_subnode_block (const shared_db_ptr &parent, const block_info &bi)
 Open a subnode_block in the specified context.
 
std::shared_ptr< subnode_leaf_blockread_subnode_leaf_block (const shared_db_ptr &parent, const block_info &bi)
 Open a subnode_leaf_block in the specified context.
 
std::shared_ptr< subnode_nonleaf_blockread_subnode_nonleaf_block (const shared_db_ptr &parent, const block_info &bi)
 Open a subnode_nonleaf_block in the specified context.
 
 database_impl ()
 
 database_impl (const std::wstring &filename)
 Construct a database_impl from this filename.
 
 database_impl (std::shared_ptr< file > file)
 Construct a database_impl from a file.
 
 database_impl (database_impl< T > *other_database)
 Construct a database_impl from another database_impl, copying its header.
 
void validate_header ()
 Validate the header of this file.
 
std::vector< byteread_block_data (const block_info &bi)
 Read block data, perform validation checks.
 
std::vector< byteread_page_data (const page_info &pi)
 Read page data, perform validation checks.
 
std::shared_ptr< nbt_leaf_pageread_nbt_leaf_page (const page_info &pi, disk::nbt_leaf_page< T > &the_page)
 
std::shared_ptr< bbt_leaf_pageread_bbt_leaf_page (const page_info &pi, disk::bbt_leaf_page< T > &the_page)
 
template<typename K , typename V >
std::shared_ptr< bt_nonleaf_page< K, V > > read_bt_nonleaf_page (const page_info &pi, disk::bt_page< T, disk::bt_entry< T > > &the_page)
 
std::shared_ptr< subnode_leaf_blockread_subnode_leaf_block (const shared_db_ptr &parent, const block_info &bi, disk::sub_leaf_block< T > &sub_block)
 
std::shared_ptr< subnode_nonleaf_blockread_subnode_nonleaf_block (const shared_db_ptr &parent, const block_info &bi, disk::sub_nonleaf_block< T > &sub_block)
 
shared_db_ptr open_database (const std::wstring &filename)
 Open a db_context for the given file.
 
shared_db_ptr open_database (std::shared_ptr< file > file)
 Open a db_context for the given file instance.
 
shared_db_ptr open_database (const shared_db_ptr &other_database)
 Open a db_context by copying the in-memory header and file handle from another db_context.
 
std::shared_ptr< small_pstopen_small_pst (const std::wstring &filename)
 Try to open the given file as an ANSI store.
 
std::shared_ptr< small_pstopen_small_pst (std::shared_ptr< file > file)
 Try to open the given file as an ANSI store with custom file instance.
 
std::shared_ptr< large_pstopen_large_pst (const std::wstring &filename)
 Try to open the given file as a Unicode store.
 
std::shared_ptr< large_pstopen_large_pst (std::shared_ptr< file > file)
 Try to open the given file as a Unicode store with custom file instance.
 

Detailed Description

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

PST implementation.

The actual implementation of a database context - this class is responsible for translating between the disk format (as indicated by the template parameter) and the disk-agnostic in memory classes returned from the various factory methods.

open_database will instantiate the correct database_impl type for a given filename.

Template Parameters
Tulonglong for a Unicode store, ulong for an ANSI store

Definition at line 101 of file database.h.

Constructor & Destructor Documentation

◆ database_impl() [1/4]

template<typename T >
pstsdk::database_impl< T >::database_impl ( )
protected

◆ database_impl() [2/4]

template<typename T >
pstsdk::database_impl< T >::database_impl ( const std::wstring &  filename)
inlineprotected

Construct a database_impl from this filename.

Exceptions
invalid_formatif the file format is not understood
runtime_errorif an error occurs opening the file
Parameters
[in]filenameThe filename to open

Definition at line 430 of file database.h.

◆ database_impl() [3/4]

template<typename T >
pstsdk::database_impl< T >::database_impl ( std::shared_ptr< file file)
inlineprotected

Construct a database_impl from a file.

Exceptions
invalid_formatif the file format is not understood
runtime_errorif an error occurs opening the file
Parameters
[in]fileThe file

Definition at line 441 of file database.h.

◆ database_impl() [4/4]

template<typename T >
pstsdk::database_impl< T >::database_impl ( database_impl< T > *  other_database)
inlineprotected

Construct a database_impl from another database_impl, copying its header.

Parameters
[in]other_databasePointer to the source database_impl to copy from

Definition at line 452 of file database.h.

Member Function Documentation

◆ lookup_block_info()

template<typename T >
pstsdk::block_info pstsdk::database_impl< T >::lookup_block_info ( block_id  bid)
inlinevirtual

Lookup information about a block.

Exceptions
key_not_found<block_id>if the specified block was not found
Parameters
[in]bidThe id of the block to lookup
Returns
Information about the specified block

Implements pstsdk::db_context.

Definition at line 651 of file database.h.

◆ lookup_node()

template<typename T >
node pstsdk::database_impl< T >::lookup_node ( node_id  nid)
inlinevirtual

Open a node.

Exceptions
key_not_found<node_id>if the specified node was not found
Parameters
[in]nidThe id of the node to lookup
Returns
A node instance

Implements pstsdk::db_context.

Definition at line 107 of file database.h.

◆ lookup_node_info()

template<typename T >
pstsdk::node_info pstsdk::database_impl< T >::lookup_node_info ( node_id  nid)
inlinevirtual

Lookup information about a node.

Exceptions
key_not_found<node_id>if the specified node was not found
Parameters
[in]nidThe id of the node to lookup
Returns
Information about the specified node

Implements pstsdk::db_context.

Definition at line 645 of file database.h.

◆ read_bbt_leaf_page() [1/2]

template<typename T >
std::shared_ptr< pstsdk::bbt_leaf_page > pstsdk::database_impl< T >::read_bbt_leaf_page ( const page_info pi)
inlinevirtual

Open a BBT leaf page.

Parameters
[in]piInformation about the page to open
Exceptions
unexpected_page(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect
database_corrupt(PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer
Returns
The requested page

Implements pstsdk::db_context.

Definition at line 500 of file database.h.

◆ read_bbt_leaf_page() [2/2]

template<typename T >
std::shared_ptr< pstsdk::bbt_leaf_page > pstsdk::database_impl< T >::read_bbt_leaf_page ( const page_info pi,
disk::bbt_leaf_page< T > &  the_page 
)
inlineprotected

Definition at line 517 of file database.h.

◆ read_bbt_nonleaf_page()

template<typename T >
std::shared_ptr< pstsdk::bbt_nonleaf_page > pstsdk::database_impl< T >::read_bbt_nonleaf_page ( const page_info pi)
inlinevirtual

Open a BBT nonleaf page.

Parameters
[in]piInformation about the page to open
Exceptions
unexpected_page(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect
database_corrupt(PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer
Returns
The requested page

Implements pstsdk::db_context.

Definition at line 576 of file database.h.

◆ read_bbt_page()

template<typename T >
std::shared_ptr< pstsdk::bbt_page > pstsdk::database_impl< T >::read_bbt_page ( const page_info pi)
inlinevirtual

Open a BBT page.

Exceptions
unexpected_page(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect
database_corrupt(PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer
Returns
The requested page

Implements pstsdk::db_context.

Definition at line 593 of file database.h.

◆ read_bbt_root()

template<typename T >
std::shared_ptr< pstsdk::bbt_page > pstsdk::database_impl< T >::read_bbt_root ( )
inlinevirtual

Get the root of the BBT of this context.

Exceptions
unexpected_page(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect
database_corrupt(PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer
Returns
The requested page

Implements pstsdk::db_context.

Definition at line 406 of file database.h.

◆ read_block() [1/2]

template<typename T >
std::shared_ptr< block > pstsdk::database_impl< T >::read_block ( const shared_db_ptr parent,
block_id  bid 
)
inlinevirtual

Open a block in the specified context.

Parameters
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]bidThe id of the block to open
Exceptions
unexpected_block(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns
The requested block

Implements pstsdk::db_context.

Definition at line 127 of file database.h.

◆ read_block() [2/2]

template<typename T >
std::shared_ptr< pstsdk::block > pstsdk::database_impl< T >::read_block ( const shared_db_ptr parent,
const block_info bi 
)
inlinevirtual

Open a block in the specified context.

Parameters
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]biInformation about the block to open
Exceptions
unexpected_block(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns
The requested block

Implements pstsdk::db_context.

Definition at line 666 of file database.h.

◆ read_block_data()

template<typename T >
std::vector< pstsdk::byte > pstsdk::database_impl< T >::read_block_data ( const block_info bi)
inlineprotected

Read block data, perform validation checks.

Parameters
[in]biThe block information to read from disk
Exceptions
unexpected_block(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns
The validated block data (still "encrypted")

Definition at line 331 of file database.h.

◆ read_bt_nonleaf_page() [1/2]

template<typename T >
template<typename K , typename V >
std::shared_ptr< bt_nonleaf_page< K, V > > pstsdk::database_impl< T >::read_bt_nonleaf_page ( const page_info pi,
disk::bt_page< T, disk::bt_entry< T > > &  the_page 
)
protected

◆ read_bt_nonleaf_page() [2/2]

template<typename T >
template<typename K , typename V >
std::shared_ptr< pstsdk::bt_nonleaf_page< K, V > > pstsdk::database_impl< T >::read_bt_nonleaf_page ( const page_info pi,
pstsdk::disk::bt_page< T, disk::bt_entry< T > > &  the_page 
)
inline

Definition at line 558 of file database.h.

◆ read_data_block() [1/2]

template<typename T >
std::shared_ptr< data_block > pstsdk::database_impl< T >::read_data_block ( const shared_db_ptr parent,
block_id  bid 
)
inlinevirtual

Open a data_block in the specified context.

Parameters
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]bidThe id of the block to open
Exceptions
unexpected_block(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns
The requested block

Implements pstsdk::db_context.

Definition at line 129 of file database.h.

◆ read_data_block() [2/2]

template<typename T >
std::shared_ptr< pstsdk::data_block > pstsdk::database_impl< T >::read_data_block ( const shared_db_ptr parent,
const block_info bi 
)
inlinevirtual

Open a data_block in the specified context.

Parameters
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]biInformation about the block to open
Exceptions
unexpected_block(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns
The requested block

Implements pstsdk::db_context.

Definition at line 683 of file database.h.

◆ read_extended_block() [1/2]

template<typename T >
std::shared_ptr< extended_block > pstsdk::database_impl< T >::read_extended_block ( const shared_db_ptr parent,
block_id  bid 
)
inlinevirtual

Open an extended_block in the specified context.

Parameters
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]bidThe id of the block to open
Exceptions
unexpected_block(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns
The requested block

Implements pstsdk::db_context.

Definition at line 131 of file database.h.

◆ read_extended_block() [2/2]

template<typename T >
std::shared_ptr< pstsdk::extended_block > pstsdk::database_impl< T >::read_extended_block ( const shared_db_ptr parent,
const block_info bi 
)
inlinevirtual

Open a extended_block in the specified context.

Parameters
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]biInformation about the block to open
Exceptions
unexpected_block(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns
The requested block

Implements pstsdk::db_context.

Definition at line 700 of file database.h.

◆ read_external_block() [1/2]

template<typename T >
std::shared_ptr< external_block > pstsdk::database_impl< T >::read_external_block ( const shared_db_ptr parent,
block_id  bid 
)
inlinevirtual

Open a external_block in the specified context.

Parameters
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]bidThe id of the block to open
Exceptions
unexpected_block(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns
The requested block

Implements pstsdk::db_context.

Definition at line 133 of file database.h.

◆ read_external_block() [2/2]

template<typename T >
std::shared_ptr< pstsdk::external_block > pstsdk::database_impl< T >::read_external_block ( const shared_db_ptr parent,
const block_info bi 
)
inlinevirtual

Open a external_block in the specified context.

Parameters
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]biInformation about the block to open
Exceptions
unexpected_block(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns
The requested block

Implements pstsdk::db_context.

Definition at line 788 of file database.h.

◆ read_nbt_leaf_page() [1/2]

template<typename T >
std::shared_ptr< pstsdk::nbt_leaf_page > pstsdk::database_impl< T >::read_nbt_leaf_page ( const page_info pi)
inlinevirtual

Open a NBT leaf page.

Parameters
[in]piInformation about the page to open
Exceptions
unexpected_page(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect
database_corrupt(PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer
Returns
The requested page

Implements pstsdk::db_context.

Definition at line 460 of file database.h.

◆ read_nbt_leaf_page() [2/2]

template<typename T >
std::shared_ptr< pstsdk::nbt_leaf_page > pstsdk::database_impl< T >::read_nbt_leaf_page ( const page_info pi,
disk::nbt_leaf_page< T > &  the_page 
)
inlineprotected

Definition at line 477 of file database.h.

◆ read_nbt_nonleaf_page()

template<typename T >
std::shared_ptr< pstsdk::nbt_nonleaf_page > pstsdk::database_impl< T >::read_nbt_nonleaf_page ( const page_info pi)
inlinevirtual

Open a NBT nonleaf page.

Parameters
[in]piInformation about the page to open
Exceptions
unexpected_page(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect
database_corrupt(PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer
Returns
The requested page

Implements pstsdk::db_context.

Definition at line 540 of file database.h.

◆ read_nbt_page()

template<typename T >
std::shared_ptr< pstsdk::nbt_page > pstsdk::database_impl< T >::read_nbt_page ( const page_info pi)
inlinevirtual

Open a NBT page.

Parameters
[in]piInformation about the page to open
Exceptions
unexpected_page(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect
database_corrupt(PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer
Returns
The requested page

Implements pstsdk::db_context.

Definition at line 619 of file database.h.

◆ read_nbt_root()

template<typename T >
std::shared_ptr< pstsdk::nbt_page > pstsdk::database_impl< T >::read_nbt_root ( )
inlinevirtual

Get the root of the NBT of this context.

Exceptions
unexpected_page(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect
database_corrupt(PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer
Returns
The requested page

Implements pstsdk::db_context.

Definition at line 418 of file database.h.

◆ read_page_data()

template<typename T >
std::vector< pstsdk::byte > pstsdk::database_impl< T >::read_page_data ( const page_info pi)
protected

Read page data, perform validation checks.

Parameters
[in]piThe page information to read from disk
Exceptions
unexpected_page(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect
database_corrupt(PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer
Returns
The validated page data

Definition at line 369 of file database.h.

◆ read_subnode_block() [1/2]

template<typename T >
std::shared_ptr< subnode_block > pstsdk::database_impl< T >::read_subnode_block ( const shared_db_ptr parent,
block_id  bid 
)
inlinevirtual

Open a subnode_block in the specified context.

Parameters
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]bidThe id of the block to open
Exceptions
unexpected_block(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns
The requested block

Implements pstsdk::db_context.

Definition at line 135 of file database.h.

◆ read_subnode_block() [2/2]

template<typename T >
std::shared_ptr< pstsdk::subnode_block > pstsdk::database_impl< T >::read_subnode_block ( const shared_db_ptr parent,
const block_info bi 
)
inlinevirtual

Open a subnode_block in the specified context.

Parameters
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]biInformation about the block to open
Exceptions
unexpected_block(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns
The requested block

Implements pstsdk::db_context.

Definition at line 817 of file database.h.

◆ read_subnode_leaf_block() [1/3]

template<typename T >
std::shared_ptr< subnode_leaf_block > pstsdk::database_impl< T >::read_subnode_leaf_block ( const shared_db_ptr parent,
block_id  bid 
)
inlinevirtual

Open a subnode_leaf_block in the specified context.

Parameters
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]bidThe id of the block to open
Exceptions
unexpected_block(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns
The requested block

Implements pstsdk::db_context.

Definition at line 137 of file database.h.

◆ read_subnode_leaf_block() [2/3]

template<typename T >
std::shared_ptr< pstsdk::subnode_leaf_block > pstsdk::database_impl< T >::read_subnode_leaf_block ( const shared_db_ptr parent,
const block_info bi 
)
inlinevirtual

Open a subnode_leaf_block in the specified context.

Parameters
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]biInformation about the block to open
Exceptions
unexpected_block(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns
The requested block

Implements pstsdk::db_context.

Definition at line 841 of file database.h.

◆ read_subnode_leaf_block() [3/3]

template<typename T >
std::shared_ptr< pstsdk::subnode_leaf_block > pstsdk::database_impl< T >::read_subnode_leaf_block ( const shared_db_ptr parent,
const block_info bi,
disk::sub_leaf_block< T > &  sub_block 
)
inlineprotected

Definition at line 879 of file database.h.

◆ read_subnode_nonleaf_block() [1/3]

template<typename T >
std::shared_ptr< subnode_nonleaf_block > pstsdk::database_impl< T >::read_subnode_nonleaf_block ( const shared_db_ptr parent,
block_id  bid 
)
inlinevirtual

Open a subnode_nonleaf_block in the specified context.

Parameters
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]bidThe id of the block to open
Exceptions
unexpected_block(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns
The requested block

Implements pstsdk::db_context.

Definition at line 139 of file database.h.

◆ read_subnode_nonleaf_block() [2/3]

template<typename T >
std::shared_ptr< pstsdk::subnode_nonleaf_block > pstsdk::database_impl< T >::read_subnode_nonleaf_block ( const shared_db_ptr parent,
const block_info bi 
)
inlinevirtual

Open a subnode_nonleaf_block in the specified context.

Parameters
[in]parentThe context to open this block in. It must be either this context or a child context of this context.
[in]biInformation about the block to open
Exceptions
unexpected_block(PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect
sig_mismatch(PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect
crc_fail(PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer
Returns
The requested block

Implements pstsdk::db_context.

Definition at line 860 of file database.h.

◆ read_subnode_nonleaf_block() [3/3]

template<typename T >
std::shared_ptr< pstsdk::subnode_nonleaf_block > pstsdk::database_impl< T >::read_subnode_nonleaf_block ( const shared_db_ptr parent,
const block_info bi,
disk::sub_nonleaf_block< T > &  sub_block 
)
inlineprotected

Definition at line 901 of file database.h.

◆ validate_header()

template<typename T >
void pstsdk::database_impl< T >::validate_header ( )
protected

Validate the header of this file.

Exceptions
invalid_formatif this header is for a database format incompatible with this object
crc_fail(PSTSDK_VALIDATION_LEVEL_WEAK) if the CRC of this header doesn't match

Friends And Related Symbol Documentation

◆ open_database [1/3]

template<typename T >
shared_db_ptr open_database ( const shared_db_ptr other_database)
friend

Open a db_context by copying the in-memory header and file handle from another db_context.

Parameters
[in]other_databaseA reference to an existing shared_db_ptr to copy from
Returns
A shared_ptr to the new database context, or nullptr if the input type is unknown

◆ open_database [2/3]

template<typename T >
shared_db_ptr open_database ( const std::wstring &  filename)
friend

Open a db_context for the given file.

Exceptions
invalid_formatif the file format is not understood
runtime_errorif an error occurs opening the file
crc_fail(PSTSDK_VALIDATION_LEVEL_WEAK) if the CRC of this header doesn't match
Parameters
[in]filenameThe filename to open
Returns
A shared_ptr to the opened context

◆ open_database [3/3]

template<typename T >
shared_db_ptr open_database ( std::shared_ptr< file file)
friend

Open a db_context for the given file instance.

Exceptions
invalid_formatif the file format is not understood
runtime_errorif an error occurs opening the file
crc_fail(PSTSDK_VALIDATION_LEVEL_WEAK) if the CRC of this header doesn't match
Parameters
[in]fileA shared_ptr to a file instance (e.g., backed by custom filesystem)
Returns
A shared_ptr to the opened context

◆ open_large_pst [1/2]

template<typename T >
std::shared_ptr< large_pst > open_large_pst ( const std::wstring &  filename)
friend

Try to open the given file as a Unicode store.

Exceptions
invalid_formatif the file format is not Unicode
runtime_errorif an error occurs opening the file
crc_fail(PSTSDK_VALIDATION_LEVEL_WEAK) if the CRC of this header doesn't match
Parameters
[in]filenameThe filename to open
Returns
A shared_ptr to the opened context

◆ open_large_pst [2/2]

template<typename T >
std::shared_ptr< large_pst > open_large_pst ( std::shared_ptr< file file)
friend

Try to open the given file as a Unicode store with custom file instance.

Exceptions
invalid_formatif the file format is not Unicode
runtime_errorif an error occurs opening the file
crc_fail(PSTSDK_VALIDATION_LEVEL_WEAK) if the CRC of this header doesn't match
Parameters
[in]fileA shared_ptr to a file instance
Returns
A shared_ptr to the opened context

◆ open_small_pst [1/2]

template<typename T >
std::shared_ptr< small_pst > open_small_pst ( const std::wstring &  filename)
friend

Try to open the given file as an ANSI store.

Exceptions
invalid_formatif the file format is not ANSI
runtime_errorif an error occurs opening the file
crc_fail(PSTSDK_VALIDATION_LEVEL_WEAK) if the CRC of this header doesn't match
Parameters
[in]filenameThe filename to open
Returns
A shared_ptr to the opened context

◆ open_small_pst [2/2]

template<typename T >
std::shared_ptr< small_pst > open_small_pst ( std::shared_ptr< file file)
friend

Try to open the given file as an ANSI store with custom file instance.

Exceptions
invalid_formatif the file format is not ANSI
runtime_errorif an error occurs opening the file
crc_fail(PSTSDK_VALIDATION_LEVEL_WEAK) if the CRC of this header doesn't match
Parameters
[in]fileA shared_ptr to a file instance
Returns
A shared_ptr to the opened context

Member Data Documentation

◆ m_bbt_root

template<typename T >
std::shared_ptr<bbt_page> pstsdk::database_impl< T >::m_bbt_root
protected

Definition at line 219 of file database.h.

◆ m_file

template<typename T >
std::shared_ptr<file> pstsdk::database_impl< T >::m_file
protected

Definition at line 217 of file database.h.

◆ m_header

template<typename T >
disk::header<T> pstsdk::database_impl< T >::m_header
protected

Definition at line 218 of file database.h.

◆ m_nbt_root

template<typename T >
std::shared_ptr<nbt_page> pstsdk::database_impl< T >::m_nbt_root
protected

Definition at line 220 of file database.h.


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