#pragma once #include namespace Nz { template class Asset final { public: const std::shared_ptr& Get() const { return m_resource; } explicit operator bool() const noexcept { return !!m_resource; } TResource& operator*() { return *m_resource.get(); } const TResource& operator*() const { return *m_resource.get(); } TResource* operator->() { return m_resource.get(); } const TResource* operator->() const { return m_resource.get(); } static Asset LoadFromFile(const std::filesystem::path& path); protected: AssetDescriptor m_descriptor; std::shared_ptr m_resource; friend class AssetCatalog; }; } #include