![]() |
Blamite Game Engine - blam!
00346.12.11.21.0529.blamite
The core library for the Blamite Game Engine.
|
Namespace containing functions related to caching. More...
Functions | |
std::string | WriteFileToCache (void *data, int length, std::string id) |
Writes a block of data to the cache as a file. More... | |
BlamResult | ReadFileFromCache (void **data, int *length, std::string id) |
Reads a file from the cache into memory. More... | |
BlamResult | DeleteFileFromCache (std::string id) |
Deletes a file from the local cache storage. More... | |
void | ClearCachedFiles () |
Clears all files from the cache. More... | |
Namespace containing functions related to caching.
void Blam::Cache::ClearCachedFiles | ( | ) |
Clears all files from the cache.
Will log to console if any files failed to be removed.
BlamResult Blam::Cache::DeleteFileFromCache | ( | std::string | id | ) |
Deletes a file from the local cache storage.
Will log an error to console if the file could not be removed.
id | - The ID of the cached file to delete. |
BlamResult::Success_OK
if the file was deleted successfully, otherwise returns an error code. BlamResult Blam::Cache::ReadFileFromCache | ( | void ** | data, |
int * | length, | ||
std::string | id | ||
) |
Reads a file from the cache into memory.
Memory allocation does not need to be performed prior to calling, as this function will call malloc() on its own.
data | - Pointer at which to write the memory. |
length | - Pointer at which to store the size of the data. |
id | - The ID of the cached data to read |
BlamResult::Success_OK
if the file was loaded without error, will return an error code if no cached file could be found with the specified ID. std::string Blam::Cache::WriteFileToCache | ( | void * | data, |
int | length, | ||
std::string | id | ||
) |
Writes a block of data to the cache as a file.
data | - The data to put in the file |
length | - The size of the data in bytes |
id | - The ID of the cached data, used to retrieve the file later on |