JUCE  v5.4.1-191-g0ab5e696f
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::Message Class Reference

The base class for objects that can be sent to a MessageListener. More...

#include <juce_Message.h>

Inheritance diagram for juce::Message:
Collaboration diagram for juce::Message:

Public Types

using Ptr = ReferenceCountedObjectPtr< Message >
 

Public Member Functions

 Message () noexcept
 Creates an uninitialised message. More...
 
 ~Message () override
 
void decReferenceCount () noexcept
 Decreases the object's reference count. More...
 
bool decReferenceCountWithoutDeleting () noexcept
 Decreases the object's reference count. More...
 
int getReferenceCount () const noexcept
 Returns the object's current reference count. More...
 
void incReferenceCount () noexcept
 Increments the object's reference count. More...
 
bool post ()
 

Protected Member Functions

void resetReferenceCount () noexcept
 Resets the reference count to zero without deleting the object. More...
 

Private Member Functions

void messageCallback () override
 

Private Attributes

WeakReference< MessageListenerrecipient
 

Friends

class MessageListener
 

Detailed Description

The base class for objects that can be sent to a MessageListener.

If you want to send a message that carries some kind of custom data, just create a subclass of Message with some appropriate member variables to hold your data.

Always create a new instance of a Message object on the heap, as it will be deleted automatically after the message has been delivered.

See also
MessageListener, MessageManager, ActionListener, ChangeListener

{Events}

Member Typedef Documentation

◆ Ptr

Constructor & Destructor Documentation

◆ Message()

juce::Message::Message ( )
noexcept

Creates an uninitialised message.

◆ ~Message()

juce::Message::~Message ( )
override

Member Function Documentation

◆ decReferenceCount()

void juce::ReferenceCountedObject::decReferenceCount ( )
inlinenoexceptinherited

Decreases the object's reference count.

If the count gets to zero, the object will be deleted.

References jassert.

◆ decReferenceCountWithoutDeleting()

bool juce::ReferenceCountedObject::decReferenceCountWithoutDeleting ( )
inlinenoexceptinherited

Decreases the object's reference count.

If the count gets to zero, the object will not be deleted, but this method will return true, allowing the caller to take care of deletion.

References jassert.

◆ getReferenceCount()

int juce::ReferenceCountedObject::getReferenceCount ( ) const
inlinenoexceptinherited

Returns the object's current reference count.

◆ incReferenceCount()

void juce::ReferenceCountedObject::incReferenceCount ( )
inlinenoexceptinherited

Increments the object's reference count.

This is done automatically by the smart pointer, but is public just in case it's needed for nefarious purposes.

◆ messageCallback()

void juce::Message::messageCallback ( )
overrideprivatevirtual

◆ post()

bool juce::MessageManager::MessageBase::post ( )
inherited

◆ resetReferenceCount()

void juce::ReferenceCountedObject::resetReferenceCount ( )
inlineprotectednoexceptinherited

Resets the reference count to zero without deleting the object.

You should probably never need to use this!

Friends And Related Function Documentation

◆ MessageListener

friend class MessageListener
friend

Member Data Documentation

◆ recipient

WeakReference<MessageListener> juce::Message::recipient
private

The documentation for this class was generated from the following file: