Pyrogenesis  trunk
Public Member Functions | Private Attributes | List of all members
CVFSFile Class Reference

Reads a file, then gives read-only access to the contents. More...

#include <Filesystem.h>

Collaboration diagram for CVFSFile:
Collaboration graph
[legend]

Public Member Functions

 CVFSFile ()
 
 ~CVFSFile ()
 
PSRETURN Load (const PIVFS &vfs, const VfsPath &filename, bool log=true)
 Returns either PSRETURN_OK or PSRETURN_CVFSFile_LoadFailed. More...
 
const u8GetBuffer () const
 Returns buffer of this file as a stream of bytes. More...
 
size_t GetBufferSize () const
 
CStr GetAsString () const
 Returns contents of file as a string. More...
 
CStr DecodeUTF8 () const
 Returns contents of a UTF-8 encoded file as a string with optional BOM removed. More...
 

Private Attributes

shared_ptr< u8m_Buffer
 
size_t m_BufferSize
 

Detailed Description

Reads a file, then gives read-only access to the contents.

Constructor & Destructor Documentation

CVFSFile::CVFSFile ( )
CVFSFile::~CVFSFile ( )

Member Function Documentation

CStr CVFSFile::DecodeUTF8 ( ) const

Returns contents of a UTF-8 encoded file as a string with optional BOM removed.

Note
file must have been successfully loaded
CStr CVFSFile::GetAsString ( ) const

Returns contents of file as a string.

Note
file must have been successfully loaded
const u8 * CVFSFile::GetBuffer ( ) const

Returns buffer of this file as a stream of bytes.

Note
file must have been successfully loaded
size_t CVFSFile::GetBufferSize ( ) const
PSRETURN CVFSFile::Load ( const PIVFS vfs,
const VfsPath filename,
bool  log = true 
)

Returns either PSRETURN_OK or PSRETURN_CVFSFile_LoadFailed.

Note
Dies if the file has already been successfully loaded
Parameters
logWhether to log a failure to load a file

Member Data Documentation

shared_ptr<u8> CVFSFile::m_Buffer
private
size_t CVFSFile::m_BufferSize
private

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