Kigs Framework  Doc version 0.8
Open source multi purpose Rapid Application Development framework
Public Member Functions | Static Public Member Functions | List of all members
ModuleFileManager Class Reference

#include <ModuleFileManager.h>

Inherits ModuleBase.

Public Member Functions

void Init (KigsCore *core, const kstl::vector< CoreModifiableAttribute * > *params) override
 module init More...
 
void Close () override
 module close
 
void Update (const Timer &timer, void *addParam) override
 module update
 

Static Public Member Functions

static CoreRawBuffer * LoadFile (const char *pFilename, u64 &filelength, u64 startOffset=0, unsigned int trailing_zero=0)
 
static CoreRawBuffer * LoadFileAsCharString (const char *pFilename, u64 &filelength, u8 charSize, u64 startOffset=0)
 load a file and add a zero at the end of the char buffer More...
 
static bool SaveFile (const char *filename, u8 *data, u64 length)
 
static bool CoreCopyFile (const char *sourceFilename, const char *destFileName, int buffLen=2048)
 

Detailed Description

Manage classes related to pathes and file reading / writing.

Member Function Documentation

◆ CoreCopyFile()

bool ModuleFileManager::CoreCopyFile ( const char *  sourceFilename,
const char *  destFileName,
int  buffLen = 2048 
)
static

copy a binary file

Parameters
sourceFilenamename of the file to copy
destFileNamename of the file to create or overwrite
Returns
true if file was copied

◆ Init()

void ModuleFileManager::Init ( KigsCore core,
const kstl::vector< CoreModifiableAttribute * > *  params 
)
override

module init

module init, register FilePathManager

◆ LoadFile()

CoreRawBuffer * ModuleFileManager::LoadFile ( const char *  pFilename,
u64 &  filelength,
u64  startOffset = 0,
unsigned int  trailing_zero = 0 
)
static

load a binary file

Parameters
pFilenamename of the file
filelengthlength of the file
startOffsetoffset from the start of the file
Returns
a pointer on the loaded file in memory
Note
returned pointer must be deleted with delete[] after use

◆ LoadFileAsCharString()

CoreRawBuffer * ModuleFileManager::LoadFileAsCharString ( const char *  pFilename,
u64 &  filelength,
u8  charSize,
u64  startOffset = 0 
)
static

load a file and add a zero at the end of the char buffer

load a text file in a string, add a 0 character at the end of the char buffer

Parameters
pFilenamename of the file
filelengthlength of the file
startOffsetoffset from the start of the file
Returns
a pointer on the loaded file in memory
Note
returned pointer must be deleted with delete[] after use

◆ SaveFile()

bool ModuleFileManager::SaveFile ( const char *  filename,
u8 *  data,
u64  length 
)
static

save a binary file

Parameters
filenamename of the file to create (or overwrite)
databinary data to save
lengthlength of the data
Returns
true if data was written into specified file, false otherwise

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