1#ifndef SDL3PP_RESOURCE_H_
2#define SDL3PP_RESOURCE_H_
19template<
typename RAW_POINTER,
typename RAW_CONST_POINTER = RAW_POINTER>
34 : m_resource(resource)
42 constexpr explicit operator bool()
const {
return !!m_resource; }
67 std::swap(lhs.m_resource, rhs.m_resource);
91template<
typename BASE>
104 : BASE(resource.get())
113template<
typename RAW_POINTER,
typename RAW_CONST_POINTER>
125 : m_resource(resource)
131 : m_resource(nullptr)
136 constexpr explicit operator bool()
const {
return !!m_resource; }
constexpr ResourceBaseT(ResourceBaseT &&) noexcept=default
Move constructor.
RAW_CONST_POINTER RawConstPointer
The underlying const raw pointer type.
Definition SDL3pp_resource.h:27
constexpr RawPointer release() noexcept
Retrieves underlying resource pointer and clear this.
Definition SDL3pp_resource.h:57
constexpr RawConstPointer operator->() const noexcept
member access to underlying resource pointer.
Definition SDL3pp_resource.h:48
constexpr auto operator<=>(const ResourceBaseT &other) const =default
Comparison.
constexpr ResourceBaseT(const ResourceBaseT &)=default
Copy constructor.
RAW_POINTER RawPointer
The underlying raw pointer type.
Definition SDL3pp_resource.h:24
friend constexpr void swap(ResourceBaseT &lhs, ResourceBaseT &rhs) noexcept
Swaps the underlying resource pointers.
Definition SDL3pp_resource.h:65
constexpr RawPointer operator->() noexcept
member access to underlying resource pointer.
Definition SDL3pp_resource.h:51
constexpr ResourceBaseT(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:33
constexpr RawPointer get() const noexcept
Retrieves underlying resource pointer.
Definition SDL3pp_resource.h:54
constexpr ResourceBaseT(std::nullptr_t)
Constructs null/invalid.
Definition SDL3pp_resource.h:39
constexpr ~ResourceBaseT()=default
Destructor.
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
AnimationRaw RawPointer
Definition SDL3pp_resource.h:118
AnimationRawConst RawConstPointer
Definition SDL3pp_resource.h:121
constexpr ResourceConstRef(RawConstPointer resource)
Constructs from const pointer.
Definition SDL3pp_resource.h:124
constexpr auto operator<=>(const ResourceConstRef &other) const =default
Comparison.
constexpr ResourceConstRef(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition SDL3pp_resource.h:130
constexpr auto operator->() const
member access to underlying type.
Definition SDL3pp_resource.h:151
Main include header for the SDL3pp library.
AsyncIOBase::RawConstPointer RawConstPointer
Definition SDL3pp_resource.h:100
AsyncIOBase::RawPointer RawPointer
Definition SDL3pp_resource.h:97
constexpr ResourceRefT(const BASE &resource) noexcept
Constructs from resource.
Definition SDL3pp_resource.h:103