27 virtual std::shared_ptr<ISdlResource>
get(std::string_view resourceName)
const = 0;
32 virtual bool has(std::string_view resourceName)
const = 0;
39 std::shared_ptr<T>
getTyped(std::string_view resourceName)
const;
44 bool hasTyped(std::string_view resourceName)
const;
50 static_assert(std::is_base_of_v<ISdlResource, T>,
51 "T is not a SDL resource.");
53 std::shared_ptr<ISdlResource> rawResource =
get(resourceName);
59 std::shared_ptr<T> castedResource = std::dynamic_pointer_cast<T>(std::move(rawResource));
65 throw_formatted<SdlLoadError>(
66 "resource type (category: {}) is not the requested type (category: {}, name: {})",
71 return castedResource;
77 static_assert(std::is_base_of_v<ISdlResource, T>,
78 "T is not a SDL resource.");
View for a group of SDL references.
Definition ISdlReferenceGroup.h:18
bool hasTyped(std::string_view resourceName) const
Check the existence of resource of type T.
Definition ISdlReferenceGroup.h:75
std::shared_ptr< T > getTyped(std::string_view resourceName) const
Get a resource reference of type T with name resourceName.
Definition ISdlReferenceGroup.h:48
virtual ~ISdlReferenceGroup()=default
virtual std::shared_ptr< ISdlResource > get(std::string_view resourceName) const =0
Get a resource reference.
PH_DEFINE_INLINE_RULE_OF_5_MEMBERS_NO_DTOR(ISdlReferenceGroup)
virtual bool has(std::string_view resourceName) const =0
Check the existence of a resource reference.
std::string_view category_to_string(const ESdlTypeCategory category)
Definition ESdlTypeCategory.h:59
constexpr ESdlTypeCategory category_of()
Statically gets the SDL category of T.
Definition sdl_helpers.ipp:409
The root for all renderer implementations.
Definition EEngineProject.h:6
Low-level helpers for SDL. Helpers are in an additional sdl namespace.