Safe pointer to a T resource (inheriting from sf::Resource<T>), its pointer is automatically reseted when the resource is destroyed. More...
#include <Resource.hpp>
Public Member Functions | |
ResourcePtr () | |
Default constructor. More... | |
ResourcePtr (const T *Resource) | |
Construct from a raw resource. More... | |
ResourcePtr (const ResourcePtr< T > &Copy) | |
Copy constructor. More... | |
~ResourcePtr () | |
Destructor. More... | |
ResourcePtr< T > & | operator= (const ResourcePtr< T > &Other) |
Assignment operator from another ResourcePtr. More... | |
ResourcePtr< T > & | operator= (const T *Resource) |
Assignment operator from a raw resource. More... | |
operator const T * () const | |
Cast operator to implicitely convert the resource pointer to its raw pointer type. More... | |
const T & | operator* () const |
Operator * overload to return a reference to the actual resource. More... | |
const T * | operator-> () const |
Operator -> overload to return a pointer to the actual resource. More... | |
void | OnResourceDestroyed () |
Function called when the observed resource is about to be destroyed. More... | |
Safe pointer to a T resource (inheriting from sf::Resource<T>), its pointer is automatically reseted when the resource is destroyed.
Definition at line 43 of file Resource.hpp.
ResourcePtr::ResourcePtr | ( | ) |
Default constructor.
Definition at line 30 of file ResourcePtr.inl.
ResourcePtr::ResourcePtr | ( | const T * | Resource | ) |
Construct from a raw resource.
Resource | : Internal resource |
Definition at line 41 of file ResourcePtr.inl.
ResourcePtr::ResourcePtr | ( | const ResourcePtr< T > & | Copy | ) |
ResourcePtr::~ResourcePtr | ( | ) |
Destructor.
Definition at line 65 of file ResourcePtr.inl.
void ResourcePtr::OnResourceDestroyed | ( | ) |
Function called when the observed resource is about to be destroyed.
Definition at line 146 of file ResourcePtr.inl.
ResourcePtr::operator const T * | ( | ) | const |
Cast operator to implicitely convert the resource pointer to its raw pointer type.
This might be dangerous in the general case, but in this context it is safe enough to define this operator
This might be dangerous in the general case, but in this context it is safe enough to define this operator
Definition at line 115 of file ResourcePtr.inl.
const T & ResourcePtr::operator* | ( | ) | const |
Operator * overload to return a reference to the actual resource.
Definition at line 125 of file ResourcePtr.inl.
const T * ResourcePtr::operator-> | ( | ) | const |
Operator -> overload to return a pointer to the actual resource.
Definition at line 135 of file ResourcePtr.inl.
ResourcePtr< T > & ResourcePtr::operator= | ( | const ResourcePtr< T > & | Other | ) |
Assignment operator from another ResourcePtr.
Other | : Resource pointer to assign |
Definition at line 76 of file ResourcePtr.inl.
ResourcePtr< T > & ResourcePtr::operator= | ( | const T * | Resource | ) |
Assignment operator from a raw resource.
Definition at line 94 of file ResourcePtr.inl.