"L. Spiro Engine"
Static Public Member Functions | Static Protected Attributes

lsf::CFilesEx Class Reference

High-level file functions. More...

#include <LSFFilesEx.h>

List of all members.

Static Public Member Functions

static LSVOID LSE_CALL InitFilesEx ()
static LSVOID LSE_CALL ShutDownFilesEx ()
static LSBOOL LSE_CALL LoadFileToMemory (const LSCHAR *_pcFile, LSUINT8 *&_pui8Buffer, LSUINTPTR *_puiptrSize, CStdAllocator *_psaAllocator=NULL)
static LSVOID LSE_CALL FreeFile (LSUINT8 *_pui8Buffer, CStdAllocator *_psaAllocator=NULL)
static LSBOOL LSE_CALL SendBufferToFile (const LSCHAR *_pcPath, const LSUINT8 *_pui8Buffer, LSUINTPTR _uiptrSize)

Static Protected Attributes

static CStdAllocator * m_psaAllocator

Detailed Description

High-level file functions.

Class CFilesEx Description: Building off the low-level file routines, this class provides higher-level file functionality such as loading files to RAM.


Member Function Documentation

static LSVOID LSE_CALL lsf::CFilesEx::FreeFile ( LSUINT8 *  _pui8Buffer,
CStdAllocator *  _psaAllocator = NULL 
) [static]

Remove from RAM a file that was loaded via LoadFileToMemory().

Parameters:
_pui8BufferThe file data previously filled by a successful call to LoadFileToMemory().
_psaAllocatorOptional pointer to the allocator used to allocate _pui8Buffer. This should be the same value that was passed to LoadFileToMemory(), even (especially) if NULL was passed.
static LSVOID LSE_CALL lsf::CFilesEx::InitFilesEx ( ) [static]

Initialize the extended file functionality. Required before LoadFileToMemory() and FreeFile() can be used with a NULL allocator.

static LSBOOL LSE_CALL lsf::CFilesEx::LoadFileToMemory ( const LSCHAR *  _pcFile,
LSUINT8 *&  _pui8Buffer,
LSUINTPTR *  _puiptrSize,
CStdAllocator *  _psaAllocator = NULL 
) [static]

Load a file fully to RAM.

Parameters:
_pcFilePath to the file to load. Must be in UTF-8 format.
_pui8BufferHolds the returned file data. This buffer is allocated using _psaAllocator.
_puiptrSizeOptional value to hold the size of the loaded file. If not needed, set to NULL.
_psaAllocatorOptional pointer to the allocator to use to allocate _pui8Buffer.
Returns:
Returns true on success, false otherwise.
static LSBOOL LSE_CALL lsf::CFilesEx::SendBufferToFile ( const LSCHAR *  _pcPath,
const LSUINT8 *  _pui8Buffer,
LSUINTPTR  _uiptrSize 
) [static]

Write a buffer to a file. If the file exists its contents are erased.

Parameters:
_pcPathPointer to a string containing the path of the file to create. Its contents will be overwritten.
_pui8BufferThe buffer to write to the given file path.
_uiptrSizeNumber of bytes to write.
Returns:
Returns true if the file was created and its contents written.
static LSVOID LSE_CALL lsf::CFilesEx::ShutDownFilesEx ( ) [static]

Shut down the extended file functionality when the engine closes.


Member Data Documentation

CStdAllocator* lsf::CFilesEx::m_psaAllocator [static, protected]

Default allocator.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator