template<class T, class U = T>
Resource class
Resource reference.
Contents
See ResourceManager for more information.
Constructors, destructors, conversion operators
- Resource() explicit
- Default constructor.
- Resource(const Resource<T, U>& other)
- Copy constructor.
- Resource(Resource<T, U>&& other)
- Move constructor.
- ~Resource()
- Destructor.
- operator bool()
- Whether the resource is available.
- operator U*()
- Pointer to resource data.
Public functions
- auto operator=(const Resource<T, U>& other) -> Resource<T, U>&
- Copy assignment.
- auto operator=(Resource<T, U>&& other) -> Resource<T, U>&
- Move assignment.
- auto key() const -> ResourceKey
- Resource key.
- auto state() -> ResourceState
- Resource state.
- auto operator*() -> U&
- Reference to resource data.
- auto operator->() -> U*
- Access to resource data.
Function documentation
template<class T, class U>
Magnum:: Resource<T, U>:: Resource() explicit
Default constructor.
Creates empty resource. Resources are acquired from the manager by calling ResourceManager::
template<class T, class U>
Magnum:: Resource<T, U>:: operator bool()
Whether the resource is available.
Returns false
when resource is not loaded and no fallback is available (i.e. state() is either ResourceState::true
otherwise.
template<class T, class U>
Magnum:: Resource<T, U>:: operator U*()
Pointer to resource data.
Returns nullptr
if the resource is not loaded.
template<class T, class U>
ResourceState Magnum:: Resource<T, U>:: state()
Resource state.
template<class T, class U>
U* Magnum:: Resource<T, U>:: operator->()
Access to resource data.
The resource must be loaded before accessing it. Use boolean conversion operator or state() for testing whether it is loaded.