|
JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins
« « « Anklang Documentation |
Holds a pointer to some type of Component, which automatically becomes null if the component is deleted. More...
#include "juce_Component.h"
Public Member Functions | |
| SafePointer ()=default | |
| Creates a null SafePointer. | |
| SafePointer (ComponentType *component) | |
| Creates a SafePointer that points at the given component. | |
| SafePointer (const SafePointer &other) noexcept | |
| Creates a copy of another SafePointer. | |
| SafePointer & | operator= (const SafePointer &other) |
| Copies another pointer to this one. | |
| SafePointer & | operator= (ComponentType *newComponent) |
| Copies another pointer to this one. | |
| ComponentType * | getComponent () const noexcept |
| Returns the component that this pointer refers to, or null if the component no longer exists. | |
| operator ComponentType * () const noexcept | |
| Returns the component that this pointer refers to, or null if the component no longer exists. | |
| ComponentType * | operator-> () const noexcept |
| Returns the component that this pointer refers to, or null if the component no longer exists. | |
| void | deleteAndZero () |
| If the component is valid, this deletes it and sets this pointer to null. | |
| bool | operator== (ComponentType *component) const noexcept |
| bool | operator!= (ComponentType *component) const noexcept |
Holds a pointer to some type of Component, which automatically becomes null if the component is deleted.
If you're using a component which may be deleted by another event that's outside of your control, use a SafePointer instead of a normal pointer to refer to it, and you can test whether it's null before using it to see if something has deleted it.
The ComponentType template parameter must be Component, or some subclass of Component.
You may also want to use a WeakReference<Component> object for the same purpose.
Definition at line 2307 of file juce_Component.h.
| juce::Component::SafePointer< ComponentType >::SafePointer | ( | ComponentType * | component | ) |
Creates a SafePointer that points at the given component.
Definition at line 2314 of file juce_Component.h.
|
noexcept |
Creates a copy of another SafePointer.
Definition at line 2317 of file juce_Component.h.
| void juce::Component::SafePointer< ComponentType >::deleteAndZero | ( | ) |
If the component is valid, this deletes it and sets this pointer to null.
Definition at line 2335 of file juce_Component.h.
|
noexcept |
Returns the component that this pointer refers to, or null if the component no longer exists.
Definition at line 2326 of file juce_Component.h.
|
noexcept |
Returns the component that this pointer refers to, or null if the component no longer exists.
Definition at line 2329 of file juce_Component.h.
|
noexcept |
Definition at line 2338 of file juce_Component.h.
|
noexcept |
Returns the component that this pointer refers to, or null if the component no longer exists.
Definition at line 2332 of file juce_Component.h.
| SafePointer & juce::Component::SafePointer< ComponentType >::operator= | ( | ComponentType * | newComponent | ) |
Copies another pointer to this one.
Definition at line 2323 of file juce_Component.h.
| SafePointer & juce::Component::SafePointer< ComponentType >::operator= | ( | const SafePointer< ComponentType > & | other | ) |
Copies another pointer to this one.
Definition at line 2320 of file juce_Component.h.
|
noexcept |
Definition at line 2337 of file juce_Component.h.