A smart pointer class ensuring the Qt reference counting for automatic memory management. QtPtr is a template-based smart pointer class that ensures Qt's reference counting manages the lifetime of a dynamically allocated object. When the parent owning an object is destroyed or reset, the managed object is automatically deleted. Additionally, when the observed object is destructed, the object observing will turn null.
More...
|
| QtPtr (const QtPtr &)=default |
|
| QtPtr (const UniqueQtPtr< ObjectType > &observe) |
| Constructs a QtPtr that observes a given UniqueQtPtr object.
|
|
| QtPtr (ObjectType *const observe=nullptr) |
| Constructs a QtPtr that observes a given Qt object.
|
|
| QtPtr (QtPtr &&) noexcept=default |
|
| ~QtPtr () |
| Disconnects the Qt connection associated with the pointer if the observed object is derived from QObject.
|
|
QtPtr & | operator= (const QtPtr &)=default |
|
QtPtr & | operator= (QtPtr &&) noexcept=default |
|
UniqueQtPtr< ObjectType > | releaseUnique () |
| Releases the ownership of the Qt object.
|
|
| ObserverPtr (const ObserverPtr &)=default |
|
| ObserverPtr (const std::unique_ptr< ObjectType > &observe) |
| Full initialisation constructor for observing a standard unique pointer.
|
|
| ObserverPtr (const UniqueQtPtr< ObjectType > &observe) |
| Full initialisation constructor for observing a Qt unique pointer.
|
|
| ObserverPtr (ObjectType *const observe=nullptr) |
| Full initialisation constructor for observing a naked pointer.
|
|
| ObserverPtr (ObserverPtr &&)=default |
|
| ~ObserverPtr ()=default |
|
ObjectType * | get () const noexcept |
| An accessor to the underlying pointer being observed.
|
|
| operator bool () const noexcept |
| Determines if this object is observing a pointer.
|
|
void | operator delete (void *)=delete |
|
| operator ObjectType * () const noexcept |
| Conversion operator to the underlying pointer being observed.
|
|
bool | operator!= (const ObjectType *observed) const |
| Inequality operator for testing if this object points to another specified pointer.
|
|
bool | operator!= (const ObserverPtr &other) const |
| Inequality operator for testing if this object points to another specified pointer.
|
|
bool | operator!= (const std::nullptr_t) const |
| Inequality operator for testing if this object points to null.
|
|
ObjectType & | operator* () |
| Dereference pointer to the observed pointer. The behaviour is undefined if the observed pointer is null.
|
|
ObjectType & | operator* () const |
| Dereference pointer to the observed pointer. The behaviour is undefined if the observed pointer is null.
|
|
ObjectType * | operator-> () |
| Dereference pointer to the observed pointer. The behaviour is undefined if the observed pointer is null.
|
|
ObjectType * | operator-> () const |
| Dereference pointer to the observed pointer. The behaviour is undefined if the observed pointer is null.
|
|
bool | operator< (const ObjectType *observed) const |
| Less-than operator for testing if the address observed by this object appears before another specified naked pointer's address.
|
|
bool | operator< (const ObserverPtr &other) const |
| Less-than operator for testing if the address observed by this object appears before another specified pointer's address.
|
|
ObserverPtr & | operator= (const ObserverPtr &)=default |
|
ObserverPtr & | operator= (const std::nullptr_t) |
| An assignment operator for setting the object to be null.
|
|
ObserverPtr & | operator= (ObjectType *const observe) |
| An assignment operator for setting the object to observe another pointer.
|
|
ObserverPtr & | operator= (ObserverPtr &&)=default |
|
bool | operator== (const ObjectType *observed) const |
| Equality operator for testing if this object points to another specified pointer.
|
|
bool | operator== (const ObserverPtr &other) const |
| Equality operator for testing if this object points to another specified pointer.
|
|
bool | operator== (const std::nullptr_t) const |
| Equality operator for testing if this object points to null.
|
|
template<typename ObjectType>
class drn::foundation::QtPtr< ObjectType >
A smart pointer class ensuring the Qt reference counting for automatic memory management. QtPtr is a template-based smart pointer class that ensures Qt's reference counting manages the lifetime of a dynamically allocated object. When the parent owning an object is destroyed or reset, the managed object is automatically deleted. Additionally, when the observed object is destructed, the object observing will turn null.
- Template Parameters
-
ObjectType | The type of the object stored. |