OpenShot Audio Library | OpenShotAudio 0.3.2
|
#include <juce_WeakReference.h>
Classes | |
class | Master |
class | SharedPointer |
Public Types | |
using | SharedRef = ReferenceCountedObjectPtr< SharedPointer > |
Public Member Functions | |
WeakReference ()=default | |
WeakReference (ObjectType *object) | |
WeakReference (const WeakReference &other) noexcept | |
WeakReference (WeakReference &&other) noexcept | |
WeakReference & | operator= (const WeakReference &other) |
WeakReference & | operator= (ObjectType *newObject) |
WeakReference & | operator= (WeakReference &&other) noexcept |
ObjectType * | get () const noexcept |
operator ObjectType * () const noexcept | |
ObjectType * | operator-> () const noexcept |
bool | wasObjectDeleted () const noexcept |
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 77 of file juce_WeakReference.h.
using juce::WeakReference< ObjectType, ReferenceCountingType >::SharedRef = ReferenceCountedObjectPtr<SharedPointer> |
Definition at line 141 of file juce_WeakReference.h.
|
inlinedefault |
Creates a null WeakReference.
|
inline |
Creates a WeakReference that points at the given object.
Definition at line 84 of file juce_WeakReference.h.
|
inlinenoexcept |
Creates a copy of another WeakReference.
Definition at line 87 of file juce_WeakReference.h.
|
inlinenoexcept |
Move constructor
Definition at line 90 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 102 of file juce_WeakReference.h.
Referenced by juce::WeakReference< juce::ActionBroadcaster >::operator juce::ActionBroadcaster *(), and juce::WeakReference< ObjectType, ReferenceCountingType >::operator->().
|
inlinenoexcept |
Returns the object that this pointer refers to, or null if the object no longer exists.
Definition at line 105 of file juce_WeakReference.h.
|
inlinenoexcept |
Definition at line 120 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 108 of file juce_WeakReference.h.
|
inline |
Copies another pointer to this one.
Definition at line 93 of file juce_WeakReference.h.
|
inline |
Copies another pointer to this one.
Definition at line 96 of file juce_WeakReference.h.
|
inlinenoexcept |
Move assignment operator
Definition at line 99 of file juce_WeakReference.h.
|
inlinenoexcept |
Definition at line 119 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 117 of file juce_WeakReference.h.