12#ifndef PSTSDK_PST_FOLDER_H
13#define PSTSDK_PST_FOLDER_H
16#include <boost/iterator/filter_iterator.hpp>
17#include <boost/iterator/transform_iterator.hpp>
66 typedef boost::transform_iterator<message_transform_row, const_table_row_iter>
message_iterator;
72 : m_db(
db), m_bag(
n) { }
76#ifndef BOOST_NO_RVALUE_REFERENCES
132 mutable std::shared_ptr<table> m_contents_table;
192 typedef boost::filter_iterator<is_nid_type<nid_type_search_folder>,
const_table_row_iter> search_folder_filter_iterator;
193 typedef boost::filter_iterator<is_nid_type<nid_type_folder>,
const_table_row_iter> folder_filter_iterator;
197 typedef boost::transform_iterator<message_transform_row, const_table_row_iter>
message_iterator;
199 typedef boost::transform_iterator<folder_transform_row, folder_filter_iterator>
folder_iterator;
207 : m_db(
db), m_bag(
n) { }
212#ifndef BOOST_NO_RVALUE_REFERENCES
216 : m_db(std::
move(
other.m_db)), m_bag(std::
move(
other.m_bag)), m_contents_table(std::
move(
other.m_contents_table)), m_associated_contents_table(std::
move(
other.m_associated_contents_table)), m_hierarchy_table(std::
move(
other.m_hierarchy_table)) { }
312 mutable std::shared_ptr<table> m_contents_table;
313 mutable std::shared_ptr<table> m_associated_contents_table;
314 mutable std::shared_ptr<table> m_hierarchy_table;
343 if(
other.m_contents_table)
344 m_contents_table.reset(
new table(*
other.m_contents_table));
350 if(
other.m_contents_table)
351 m_contents_table.reset(
new table(*
other.m_contents_table));
352 if(
other.m_associated_contents_table)
353 m_contents_table.reset(
new table(*
other.m_associated_contents_table));
354 if(
other.m_hierarchy_table)
355 m_contents_table.reset(
new table(*
other.m_hierarchy_table));
360 return folder(m_db, m_db->lookup_node(
row.get_row_id()));
365 if(!m_contents_table)
368 return *m_contents_table;
373 return const_cast<table&
>(
const_cast<const search_folder*
>(
this)->get_contents_table());
380struct folder_name_equal
382 folder_name_equal(
const std::wstring& name) : m_name(name) { }
391 folder_iterator iter = std::find_if(sub_folder_begin(), sub_folder_end(), compiler_workarounds::folder_name_equal(
name));
393 if(
iter != sub_folder_end())
401 if(!m_contents_table)
404 return *m_contents_table;
409 return const_cast<table&
>(
const_cast<const folder*
>(
this)->get_contents_table());
414 if(!m_hierarchy_table)
417 return *m_hierarchy_table;
422 return const_cast<table&
>(
const_cast<const folder*
>(
this)->get_hierarchy_table());
427 if(!m_associated_contents_table)
430 return *m_associated_contents_table;
435 return const_cast<table&
>(
const_cast<const folder*
>(
this)->get_associated_contents_table());
heap_id get_id() const
Return the heap_id of this bth_node.
Contains references to other bth_node allocations.
T read_prop(prop_id id) const
Read a property as a given type.
The iterator type exposed by the table for row iteration.
An abstraction of a table row.
size_t get_associated_message_count() const
Get the number of associated messages in this folder.
node_id get_id() const
Get the node_id of this folder.
size_t get_unread_message_count() const
Get the number of unread messages in this folder.
table & get_associated_contents_table()
Get the associated contents table of this folder.
size_t get_subfolder_count() const
Get the number of sub folders in this folder.
message_iterator message_end() const
Get the end message iterator.
size_t get_message_count() const
Get the number of messages in this folder.
shared_db_ptr get_db() const
Get the database pointer used by this folder.
folder open_sub_folder(const std::wstring &name)
Open a specific subfolder in this folder, not recursive.
property_bag & get_property_bag()
Get the property bag backing this folder.
search_folder_iterator sub_search_folder_begin() const
Get an iterator to the first search folder in this folder.
table & get_hierarchy_table()
Get the hierarchy table of this folder.
message_iterator associated_message_begin() const
Get an iterator to the first associated message in this folder.
message_iterator message_begin() const
Get an iterator to the first message in this folder.
boost::transform_iterator< search_folder_transform_row, search_folder_filter_iterator > search_folder_iterator
Search folder iterator type; a transform iterator over a filter iterator over table row iterator.
const property_bag & get_property_bag() const
Get the property bag backing this folder.
folder(folder &&other)
Move construct a folder object.
std::wstring get_name() const
Get the display name of this folder.
boost::transform_iterator< message_transform_row, const_table_row_iter > message_iterator
Message iterator type; a transform iterator over a table row iterator.
folder_iterator sub_folder_begin() const
Get an iterator to the first folder in this folder.
folder_iterator sub_folder_end() const
Get the end folder iterator.
table & get_contents_table()
Get the contents table of this folder.
boost::transform_iterator< folder_transform_row, folder_filter_iterator > folder_iterator
Folder iterator type; a transform iterator over a filter iterator over table row iterator.
search_folder_iterator sub_search_folder_end() const
Get the end search folder iterator.
folder(const shared_db_ptr &db, const node &n)
Construct a folder object.
message_iterator associated_message_end() const
Get the end associated message iterator.
An in memory representation of the "node" concept in a PST data file.
Property Context (PC) Implementation.
const node & get_node() const
Get the node underlying this property_bag.
size_t get_message_count() const
Get the number of messages in this folder.
search_folder(const shared_db_ptr &db, const node &n)
Construct a search folder object.
const property_bag & get_property_bag() const
Get the property bag backing this folder.
search_folder(search_folder &&other)
Move construct a search folder.
message_iterator message_end() const
Get the end message iterator.
shared_db_ptr get_db() const
Get the database pointer used by this folder.
node_id get_id() const
Get the node_id of this search folder.
std::wstring get_name() const
Get the display name of this folder.
boost::transform_iterator< message_transform_row, const_table_row_iter > message_iterator
Message iterator type; a transform iterator over a table row iterator.
message_iterator message_begin() const
Get an iterator to the first message in this folder.
size_t get_unread_message_count() const
Get the number of unread messages in this folder.
property_bag & get_property_bag()
Get the property bag backing this folder.
table & get_contents_table()
Get the contents table of this folder.
The actual table object that clients reference.
size_t size() const
Get the number of rows in this table.
The exceptions used by pstsdk.
ulong get_nid_index(node_id id)
Get a node index from a node id.
nid_type get_nid_type(node_id id)
Get a node type from a node id.
#define make_nid(nid_type, nid_index)
Construct a node_id (NID) from a node type and index.
@ nid_type_hierarchy_table
@ nid_type_contents_table
@ nid_type_search_contents_table
@ nid_type_associated_contents_table
Contains the definition of all in memory representations of disk structures.
std::shared_ptr< db_context > shared_db_ptr
Primitive structures defined by MS-PST and MAPI.
Property Bag (or Property Context, or PC) implementation.
Functor to determine if an object is of the specified node type.
bool operator()(const node_info &info)
bool operator()(const const_table_row &row)
An in memory, database format agnostic version of disk::nbt_leaf_entry.
Table (or Table Context, or TC) implementation.