Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CGameLoader Class Reference

Helper class for retrieving data from saved game archives. More...

Collaboration diagram for CGameLoader:

Public Member Functions

 CGameLoader (const ScriptInterface &scriptInterface, std::string *savedState)
 
void ReadEntry (const VfsPath &pathname, const CFileInfo &fileInfo, PIArchiveFile archiveFile)
 
JS::Value GetMetadata ()
 

Static Public Member Functions

static void ReadEntryCallback (const VfsPath &pathname, const CFileInfo &fileInfo, PIArchiveFile archiveFile, uintptr_t cbData)
 

Private Member Functions

 NONCOPYABLE (CGameLoader)
 

Private Attributes

const ScriptInterfacem_ScriptInterface
 
JS::PersistentRooted< JS::Value > m_Metadata
 
std::string * m_SavedState
 

Detailed Description

Helper class for retrieving data from saved game archives.

Constructor & Destructor Documentation

◆ CGameLoader()

CGameLoader::CGameLoader ( const ScriptInterface scriptInterface,
std::string *  savedState 
)
inline
Parameters
scriptInterfacethe ScriptInterface used for loading metadata.
[out]savedStateserialized simulation state stored as string of bytes, loaded from simulation.dat inside the archive.

Note: We use a different approach for returning the string and the metadata JS::Value. We use a pointer for the string to avoid copies (efficiency). We don't use this approach for the metadata because it would be error prone with rooting and the stack-based rooting types and confusing (a chain of pointers pointing to other pointers).

Member Function Documentation

◆ GetMetadata()

JS::Value CGameLoader::GetMetadata ( )
inline

◆ NONCOPYABLE()

CGameLoader::NONCOPYABLE ( CGameLoader  )
private

◆ ReadEntry()

void CGameLoader::ReadEntry ( const VfsPath pathname,
const CFileInfo fileInfo,
PIArchiveFile  archiveFile 
)
inline

◆ ReadEntryCallback()

static void CGameLoader::ReadEntryCallback ( const VfsPath pathname,
const CFileInfo fileInfo,
PIArchiveFile  archiveFile,
uintptr_t  cbData 
)
inlinestatic

Member Data Documentation

◆ m_Metadata

JS::PersistentRooted<JS::Value> CGameLoader::m_Metadata
private

◆ m_SavedState

std::string* CGameLoader::m_SavedState
private

◆ m_ScriptInterface

const ScriptInterface& CGameLoader::m_ScriptInterface
private

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