Elaztek Developer Hub
Blamite Game Engine - blam!  00398.09.22.23.2015.blamite
The core library for the Blamite Game Engine.
cache.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Windows.h>
4 #include <string>
5 #include <vector>
6 
8 
9 #ifndef BLAM
10 #define BLAM
11 #endif
12 
18 #define CACHE_FOLDER Blam::Settings::Paths::GetUserDataPath(BlamUserDataFolder::Cache)
19 
24 {
25  std::string id = "";
26  std::string old_address = "";
27  int size = 0;
28  std::string path = "";
29 };
30 
31 namespace Blam
32 {
36  namespace Cache
37  {
47  std::string WriteFileToCache(void* data, int length, std::string id);
48 
62  BlamResult ReadFileFromCache(void** data, int* length, std::string id);
63 
71  BlamResult DeleteFileFromCache(std::string id);
72 
76  void ClearCachedFiles();
77  }
78 }
Blam
Namespace surrounding all major engine components.
Definition: blam_api.h:28
Blam::Cache::ClearCachedFiles
void ClearCachedFiles()
Clears all files from the cache.
Definition: cache.cpp:81
BlamCachedDataFile
Structure to contain a cached data file.
Definition: cache.h:23
BlamContentSource::Cache
@ Cache
The engine will load all content from cache files.
Blam::Logger::LogEvent
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition: aliases.cpp:142
logger.h
Log
@ Log
Writes the error to the game log.
Definition: errors.h:16
Blam::Cache::WriteFileToCache
std::string WriteFileToCache(void *data, int length, std::string id)
Writes a block of data to the cache as a file.
Definition: cache.cpp:12
USER_DATA_PATH
#define USER_DATA_PATH(path)
Macro to quickly access a user data folder.
Definition: config.h:43
Blam::Cache::ReadFileFromCache
BlamResult ReadFileFromCache(void **data, int *length, std::string id)
Reads a file from the cache into memory.
Definition: cache.cpp:36
BlamUserDataFolder::Cache
@ Cache
Directory used to store any cached data used by the engine (not to be confused with ....
Blam::Cache::DeleteFileFromCache
BlamResult DeleteFileFromCache(std::string id)
Deletes a file from the local cache storage.
Definition: cache.cpp:60
errors.h
BlamCachedDataFile::size
int size
The length of the data, in bytes.
Definition: cache.h:27
BlamCachedDataFile::id
std::string id
The ID of the cached file.
Definition: cache.h:25
file
sock planetquake com All rights reserved Quake III Arena is a registered trademark of id Inc This level may be electronically distributed only at NO CHARGE to the recipient in its current MUST include this txt file
Definition: chiropteraDM.txt:95
BlamCachedDataFile::path
std::string path
The path to the cached file.
Definition: cache.h:28
cache.h
Blam::Error::ShowLastErrorInfo
BLAM void ShowLastErrorInfo(const char *function, BlamErrorDisplayType display_type)
Displays the last error information from Windows.
Definition: errors.cpp:66
config.h
BlamCachedDataFile::old_address
std::string old_address
The original address of the data when it was written to the cache.
Definition: cache.h:26
cached_files
std::vector< BlamCachedDataFile > cached_files
List of all cached files currently known.
Definition: cache.cpp:10