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. | |
ResourcePtr (const T *Resource) | |
Construct from a raw resource. | |
ResourcePtr (const ResourcePtr< T > &Copy) | |
Copy constructor. | |
~ResourcePtr () | |
Destructor. | |
ResourcePtr< T > & | operator= (const ResourcePtr< T > &Other) |
Assignment operator from another ResourcePtr. | |
ResourcePtr< T > & | operator= (const T *Resource) |
Assignment operator from a raw resource. | |
operator const T * () const | |
Cast operator to implicitely convert the resource pointer to its raw pointer type. | |
const T & | operator* () const |
Operator * overload to return a reference to the actual resource. | |
const T * | operator-> () const |
Operator -> overload to return a pointer to the actual resource. | |
void | OnResourceDestroyed () |
Function called when the observed resource is about to be destroyed. | |
Safe pointer to a T resource (inheriting from sf::Resource<T>), its pointer is automatically reseted when the resource is destroyed.
Definition at line 116 of file Resource.hpp.
sf::ResourcePtr< T >::ResourcePtr | ( | ) |
Default constructor.
sf::ResourcePtr< T >::ResourcePtr | ( | const T * | Resource | ) |
Construct from a raw resource.
Resource | : Internal resource |
sf::ResourcePtr< T >::ResourcePtr | ( | const ResourcePtr< T > & | Copy | ) |
Copy constructor.
Copy | : Instance to copy |
sf::ResourcePtr< T >::~ResourcePtr | ( | ) |
Destructor.
void sf::ResourcePtr< T >::OnResourceDestroyed | ( | ) |
Function called when the observed resource is about to be destroyed.
sf::ResourcePtr< T >::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
const T& sf::ResourcePtr< T >::operator* | ( | ) | const |
Operator * overload to return a reference to the actual resource.
const T* sf::ResourcePtr< T >::operator-> | ( | ) | const |
Operator -> overload to return a pointer to the actual resource.
ResourcePtr<T>& sf::ResourcePtr< T >::operator= | ( | const ResourcePtr< T > & | Other | ) |
Assignment operator from another ResourcePtr.
Other | : Resource pointer to assign |
ResourcePtr<T>& sf::ResourcePtr< T >::operator= | ( | const T * | Resource | ) |