template<typename T>
cubos::engine::Asset class

Handle to an asset of a specific type.

Template parameters
T Type of the asset.

Base classes

class AnyAsset
Handle to an asset of any type. May either be weak or strong. Weak handles do not guarantee the asset is loaded, while strong handles do.

Constructors, destructors, conversion operators

AnyAsset(std::nullptr_t ptr = nullptr)
Constructs a null handle.
AnyAsset(uuids::uuid id)
Constructs a weak handle.
AnyAsset(std::string_view str)
Constructs a weak handle. If the string is not a valid UUID, the handle will be null.
AnyAsset(const AnyAsset& other)
Constructs a copy of the given handle.
AnyAsset(AnyAsset&& other) noexcept
Constructs a handle from the given handle.

Public functions

auto toAny() const -> AnyAsset
Constructs a generic handle version of this handle.
auto operator=(const AnyAsset& other) -> Asset<T>&
Overwrites this handle with a copy of the given handle.
auto operator=(AnyAsset&& other) -> Asset<T>& noexcept
Overwrites this handle with the given handle.

Function documentation

template<typename T>
cubos::engine::Asset<T>::AnyAsset(uuids::uuid id)

Constructs a weak handle.

Parameters
id UUID of the asset.

template<typename T>
cubos::engine::Asset<T>::AnyAsset(std::string_view str)

Constructs a weak handle. If the string is not a valid UUID, the handle will be null.

Parameters
str String representation of the UUID.

template<typename T>
cubos::engine::Asset<T>::AnyAsset(const AnyAsset& other)

Constructs a copy of the given handle.

Parameters
other Handle to copy.

template<typename T>
cubos::engine::Asset<T>::AnyAsset(AnyAsset&& other) noexcept

Constructs a handle from the given handle.

Parameters
other Handle to move.

template<typename T>
AnyAsset cubos::engine::Asset<T>::toAny() const

Constructs a generic handle version of this handle.

Returns Generic handle to the same asset.

template<typename T>
Asset<T>& cubos::engine::Asset<T>::operator=(const AnyAsset& other)

Overwrites this handle with a copy of the given handle.

Parameters
other Handle to copy.
Returns Reference to this object, for chaining.

template<typename T>
Asset<T>& cubos::engine::Asset<T>::operator=(AnyAsset&& other) noexcept

Overwrites this handle with the given handle.

Parameters
other Handle to move.
Returns Reference to this object, for chaining.