Fairport  v1.0.38
fairport::file Class Reference

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

#include <util.h>

+ Inheritance diagram for fairport::file:
+ Collaboration diagram for fairport::file:

List of all members.

Public Member Functions

 file (const std::wstring &filename)
 Construct a file object from the given filename.
 ~file ()
 Close the file.
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 31 of file util.h.


Constructor & Destructor Documentation

fairport::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 122 of file util.h.

fairport::file::~file ( ) [inline]

Close the file.

Definition at line 138 of file util.h.


Member Function Documentation

size_t fairport::file::read ( std::vector< byte > &  buffer,
ulonglong  offset 
) const [inline]

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 144 of file util.h.


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