PST File Format SDK v0.4
Loading...
Searching...
No Matches
pstsdk::file Class Reference

A generic class to read and write to a file. More...

#include <util.h>

+ Inheritance diagram for pstsdk::file:
+ Collaboration diagram for pstsdk::file:

Public Member Functions

 file ()
 
 file (const std::wstring &filename)
 Construct a file object from the given filename.
 
 ~file ()
 Close the file.
 
virtual size_t read (std::vector< byte > &buffer, ulonglong offset) const
 Read from the file.
 

Detailed Description

A generic class to read and write to a file.

This was necessary to get around the 32 bit limit (4GB) file size limitation in ANSI C++. I needed to use compiler specific work arounds, and that logic is centralized here.

Definition at line 38 of file util.h.

Constructor & Destructor Documentation

◆ file() [1/2]

pstsdk::file::file ( )
inline

Definition at line 42 of file util.h.

◆ file() [2/2]

pstsdk::file::file ( const std::wstring &  filename)
inline

Construct a file object from the given filename.

Exceptions
runtime_errorif an error occurs opening the file
Parameters
[in]filenameThe file to open

Definition at line 145 of file util.h.

◆ ~file()

pstsdk::file::~file ( )
inline

Close the file.

Definition at line 161 of file util.h.

Member Function Documentation

◆ read()

size_t pstsdk::file::read ( std::vector< byte > &  buffer,
ulonglong  offset 
) const
inlinevirtual

Read from the file.

Exceptions
out_of_rangeif the requested location or location+size is past EOF
Parameters
[in,out]bufferThe buffer to store the data in. The size of this vector is the amount of data to read.
[in]offsetThe location on disk to read the data from.
Returns
The amount of data read

Definition at line 168 of file util.h.


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