#include <Magnum/Resource.h>
template<class T, class U = T>
Resource class
Resource reference.
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) noexcept
- 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>& noexcept
- Move assignment.
- auto operator==(const Resource<T, U>& other) const -> bool
- Equality comparison.
-
template<class V, class W>auto operator==(const Resource<V, W>&) const -> bool deleted
- Equality comparison with other types is explicitly disallowed.
- auto operator!=(const Resource<T, U>& other) const -> bool
- Non-equality comparison.
-
template<class V, class W>auto operator!=(const Resource<V, W>&) const -> bool deleted
- Non-equality comparison with other types is explicitly disallowed.
- 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.