This class acts as a pointer which will automatically become null if the object to which it points is deleted. More...
#include <juce_WeakReference.h>
Classes | |
class | Master |
This class is embedded inside an object to which you want to attach WeakReference pointers. More... | |
class | SharedPointer |
This class is used internally by the WeakReference class - don't use it directly in your code! More... | |
Public Types | |
typedef ReferenceCountedObjectPtr< SharedPointer > | SharedRef |
Public Member Functions | |
WeakReference () noexcept | |
Creates a null SafePointer. More... | |
WeakReference (ObjectType *const object) | |
Creates a WeakReference that points at the given object. More... | |
WeakReference (const WeakReference &other) noexcept | |
Creates a copy of another WeakReference. More... | |
WeakReference (WeakReference &&other) noexcept | |
Move constructor. More... | |
ObjectType * | get () const noexcept |
Returns the object that this pointer refers to, or null if the object no longer exists. More... | |
operator ObjectType * () const noexcept | |
Returns the object that this pointer refers to, or null if the object no longer exists. More... | |
bool | operator!= (ObjectType *const object) const noexcept |
ObjectType * | operator-> () noexcept |
Returns the object that this pointer refers to, or null if the object no longer exists. More... | |
const ObjectType * | operator-> () const noexcept |
Returns the object that this pointer refers to, or null if the object no longer exists. More... | |
WeakReference & | operator= (const WeakReference &other) |
Copies another pointer to this one. More... | |
WeakReference & | operator= (ObjectType *const newObject) |
Copies another pointer to this one. More... | |
WeakReference & | operator= (WeakReference &&other) noexcept |
Move assignment operator. More... | |
bool | operator== (ObjectType *const object) const noexcept |
bool | wasObjectDeleted () const noexcept |
This returns true if this reference has been pointing at an object, but that object has since been deleted. More... | |
Static Private Member Functions | |
static SharedPointer * | getRef (ObjectType *const o) |
Private Attributes | |
SharedRef | holder |
This class acts as a pointer which will automatically become null if the object to which it points is deleted.
To accomplish this, the source object needs to cooperate by performing a couple of simple tasks. It must embed a WeakReference::Master object, which stores a shared pointer object, and must clear this master pointer in its destructor.
E.g.
typedef ReferenceCountedObjectPtr<SharedPointer> WeakReference< ObjectType, ReferenceCountingType >::SharedRef |
|
inlinenoexcept |
Creates a null SafePointer.
|
inline |
Creates a WeakReference that points at the given object.
|
inlinenoexcept |
Creates a copy of another WeakReference.
|
inlinenoexcept |
Move constructor.
|
inlinenoexcept |
Returns the object that this pointer refers to, or null if the object no longer exists.
|
inlinestaticprivate |
Referenced by WeakReference< InterprocessConnection >::operator=().
|
inlinenoexcept |
Returns the object that this pointer refers to, or null if the object no longer exists.
|
inlinenoexcept |
|
inlinenoexcept |
Returns the object that this pointer refers to, or null if the object no longer exists.
|
inlinenoexcept |
Returns the object that this pointer refers to, or null if the object no longer exists.
|
inline |
Copies another pointer to this one.
|
inline |
Copies another pointer to this one.
|
inlinenoexcept |
Move assignment operator.
|
inlinenoexcept |
|
inlinenoexcept |
This returns true if this reference has been pointing at an object, but that object has since been deleted.
If this reference was only ever pointing at a null pointer, this will return false. Using operator=() to make this refer to a different object will reset this flag to match the status of the reference from which you're copying.
|
private |