OpenShot Library | libopenshot-audio
0.1.9
|
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 | |
using | SharedRef = ReferenceCountedObjectPtr< SharedPointer > |
Public Member Functions | |
WeakReference ()=default | |
Creates a null WeakReference. More... | |
WeakReference (ObjectType *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. | |
WeakReference & | operator= (const WeakReference &other) |
Copies another pointer to this one. More... | |
WeakReference & | operator= (ObjectType *newObject) |
Copies another pointer to this one. More... | |
WeakReference & | operator= (WeakReference &&other) noexcept |
Move assignment operator. | |
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... | |
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... | |
bool | wasObjectDeleted () const noexcept |
This returns true if this reference has been pointing at an object, but that object has since been deleted. More... | |
bool | operator== (ObjectType *object) const noexcept |
bool | operator!= (ObjectType *object) const noexcept |
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.
Note that WeakReference is not designed to be thread-safe, so if you're accessing it from different threads, you'll need to do your own locking around all uses of the pointer and the object it refers to.
E.g.
Definition at line 81 of file juce_WeakReference.h.
|
inlinedefault |
Creates a null WeakReference.
|
inline |
Creates a WeakReference that points at the given object.
Definition at line 88 of file juce_WeakReference.h.
|
inlinenoexcept |
Creates a copy of another WeakReference.
Definition at line 91 of file juce_WeakReference.h.
|
inline |
Copies another pointer to this one.
Definition at line 97 of file juce_WeakReference.h.
|
inline |
Copies another pointer to this one.
Definition at line 100 of file juce_WeakReference.h.
|
inlinenoexcept |
Returns the object that this pointer refers to, or null if the object no longer exists.
Definition at line 106 of file juce_WeakReference.h.
|
inlinenoexcept |
Returns the object that this pointer refers to, or null if the object no longer exists.
Definition at line 109 of file juce_WeakReference.h.
|
inlinenoexcept |
Returns the object that this pointer refers to, or null if the object no longer exists.
Definition at line 112 of file juce_WeakReference.h.
|
inlinenoexcept |
Returns the object that this pointer refers to, or null if the object no longer exists.
Definition at line 115 of file juce_WeakReference.h.
|
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.
Definition at line 124 of file juce_WeakReference.h.