#pragma once #include "Zone/ZoneTypes.h" #include #include struct IAssetBase { }; template class Asset : IAssetBase { public: static constexpr auto EnumEntry = AssetTypeEnum; using Type = AssetType; }; template struct AssetNameAccessor { public: static_assert(std::is_base_of_v); // static constexpr bool IS_SINGLETON = false; // const char*& operator()(AssetType::Type& asset) // { // throw std::runtime_error("Not implemented"); // } }; #define DEFINE_ASSET_NAME_ACCESSOR(assetType, nameProperty) \ template<> struct AssetNameAccessor \ { \ public: \ static_assert(std::is_base_of_v); \ static constexpr bool IS_SINGLETON = false; \ \ const char*& operator()(assetType::Type& asset) \ { \ return asset.nameProperty; \ } \ } #define DEFINE_ASSET_NAME_ACCESSOR_SINGLETON(assetType, singletonName) \ template<> struct AssetNameAccessor \ { \ public: \ static_assert(std::is_base_of_v); \ static constexpr bool IS_SINGLETON = true; \ \ const char* const& operator()(assetType::Type& asset) \ { \ static const char* NAME = singletonName; \ return NAME; \ } \ }