|
| | Cache () noexcept |
| | Constructor.
|
| |
| | ~Cache () |
| | Destructor.
|
| |
| void | load_file (const std::string &file) |
| | Load a resource.
|
| |
template<typename... Args>
requires meta::not_memory<Resource> && meta::is_class<Resource> && meta::is_instance_of_v<SpecLoader, Loader> |
| void | load_resource (const std::string &key, Args &&... args) |
| | Loads a resource with custom args.
|
| |
| void | load_folder (const std::string &dir) |
| | Load all resources in a folder.
|
| |
| void | insert (const std::string &key, std::shared_ptr< Resource > resource) noexcept |
| | Insert a resource directly into the cache.
|
| |
| std::shared_ptr< Resource > | get (const std::string &key) noexcept |
| | Get a resource.
|
| |
| bool | has (const std::string &key) noexcept |
| | Check if a resource exists.
|
| |
| void | clear () |
| | Destroy all data in cache.
|
| |
| bool | empty () const noexcept |
| | Does the cache have any resources.
|
| |
| std::size_t | size () const noexcept |
| | Get amount of resources cached.
|
| |
| const Map & | cache () const noexcept |
| | Get entire resource cache.
|
| |
template<typename Resource, typename SpecLoader>
requires meta::not_memory<Resource> && meta::is_class<Resource> &&
meta::is_instance_of_v<SpecLoader,
Loader>
class galaxy::Cache< Resource, SpecLoader >
Cache for resources such as audio, fonts, etc.
- Template Parameters
-
| Resource | A resource is a class containing data, and cannot be a ref or ptr. |
| SpecLoader | A template specialization of a Loader, to load the Resource. |
Definition at line 29 of file Cache.hpp.