Toast Engine
Loading...
Searching...
No Matches
assets::HandleBase Class Reference

Base class for type-erased asset handles. More...

#include <core_types.hpp>

Inheritance diagram for assets::HandleBase:
Collaboration diagram for assets::HandleBase:

Public Member Functions

 HandleBase (Asset *asset)
 HandleBase (Asset *asset, toast::UID uid, std::string_view uri)
 Constructs a handle that stores its source UID.
 HandleBase (const HandleBase &other)
auto operator= (const HandleBase &other) -> HandleBase &
 HandleBase (HandleBase &&other) noexcept
auto operator= (HandleBase &&other) noexcept -> HandleBase &
void onChangeCallback (std::function< void()> &&callback)
auto hasValue () const noexcept -> bool
auto uid () const noexcept -> toast::UID
auto path () const noexcept -> std::string_view
auto get () noexcept -> Asset &
auto get () const noexcept -> const Asset &
auto operator-> () noexcept -> Asset *
auto operator-> () const noexcept -> const Asset *
auto operator== (const HandleBase &other) const -> bool
auto operator< (const HandleBase &other) const -> bool

Protected Attributes

Asset * m_asset = nullptr
toast::UID m_uid
std::string m_uri

Detailed Description

Base class for type-erased asset handles.

Constructor & Destructor Documentation

◆ HandleBase()

assets::HandleBase::HandleBase ( Asset * asset,
toast::UID uid,
std::string_view uri )

Constructs a handle that stores its source UID.

If the pointer is null (unresolved handle), the Handle will still have a uid so serialization won't explode the engine. It also will make handling missing assets easier

Member Function Documentation

◆ onChangeCallback()

void assets::HandleBase::onChangeCallback ( std::function< void()> && callback)

Registers a function that will be called whenever a change on the handle's asset happens


The documentation for this class was generated from the following files:
  • engine/src/toast/assets/core_types.hpp
  • engine/src/toast/assets/types.cpp