Wasabi
Classes | Public Member Functions | Friends | List of all members
WFile Class Reference

Public Member Functions

 WFile (Wasabi *const app)
 
WError Open (std::string filename)
 
void Close ()
 
WError SaveAsset (class WFileAsset *asset)
 
template<typename T >
WError LoadAsset (std::string name, T **loadedAsset, std::vector< void * > args, std::string nameSuffix="")
 
WError LoadGenericAsset (std::string name, WFileAsset **assetOut, std::function< WFileAsset *()> createAsset, std::vector< void * > args, std::string nameSuffix)
 
uint32_t GetAssetsCount () const
 
std::pair< std::string, std::string > GetAssetInfo (uint32_t index)
 
std::pair< std::string, std::string > GetAssetInfo (std::string name)
 

Friends

class WFileAsset
 

Member Function Documentation

◆ GetAssetInfo() [1/2]

std::pair<std::string, std::string> WFile::GetAssetInfo ( std::string  name)

Returns a pair <name, type>

◆ GetAssetInfo() [2/2]

std::pair<std::string, std::string> WFile::GetAssetInfo ( uint32_t  index)

Returns a pair <name, type>

◆ LoadAsset()

template<typename T >
WError WFile::LoadAsset ( std::string  name,
T **  loadedAsset,
std::vector< void * >  args,
std::string  nameSuffix = "" 
)
inline

Loads an asset from the file given its name. If the asset with the given was already loaded, it will be immediately returned (and its refernce count will increase). If nameSuffix is not "" and the object hasn't been loaded before, then the object will be loaded into a new name and will not be saved and reused for the next LoadAsset call. Default assets, the ones that the engine internally creates, are never stored in the file, and when loaded, will just fetch the same engine assets and increase their reference count. Default assets ignore the nameSuffix parameter.

Parameters
name
loadedAsset
args
nameSuffix

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