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.
| ResourcePtr::ResourcePtr | ( | ) |
Default constructor.
Definition at line 31 of file Resource.hpp.
| ResourcePtr::ResourcePtr | ( | const T * | Resource | ) |
Construct from a raw resource.
| Resource | : Internal resource |
Definition at line 42 of file Resource.hpp.
| ResourcePtr::ResourcePtr | ( | const ResourcePtr< T > & | Copy | ) |
| ResourcePtr::~ResourcePtr | ( | ) |
Destructor.
Definition at line 66 of file Resource.hpp.
| void ResourcePtr::OnResourceDestroyed | ( | ) |
Function called when the observed resource is about to be destroyed.
Definition at line 147 of file Resource.hpp.
| 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 116 of file Resource.hpp.
| const T & ResourcePtr::operator* | ( | ) | const |
Operator * overload to return a reference to the actual resource.
Definition at line 126 of file Resource.hpp.
| const T * ResourcePtr::operator-> | ( | ) | const |
Operator -> overload to return a pointer to the actual resource.
Definition at line 136 of file Resource.hpp.
| ResourcePtr< T > & ResourcePtr::operator= | ( | const ResourcePtr< T > & | Other | ) |
Assignment operator from another ResourcePtr.
| Other | : Resource pointer to assign |
Definition at line 77 of file Resource.hpp.
| ResourcePtr< T > & ResourcePtr::operator= | ( | const T * | Resource | ) |
Assignment operator from a raw resource.
Definition at line 95 of file Resource.hpp.