OpenShot Library | libopenshot-audio  0.2.0
juce_MessageListener.cpp
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2017 - ROLI Ltd.
6 
7  JUCE is an open source library subject to commercial or open-source
8  licensing.
9 
10  The code included in this file is provided under the terms of the ISC license
11  http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12  To use, copy, modify, and/or distribute this software for any purpose with or
13  without fee is hereby granted provided that the above copyright notice and
14  this permission notice appear in all copies.
15 
16  JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17  EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18  DISCLAIMED.
19 
20  ==============================================================================
21 */
22 
23 namespace juce
24 {
25 
26 Message::Message() noexcept {}
27 Message::~Message() {}
28 
29 void Message::messageCallback()
30 {
31  if (auto* r = recipient.get())
32  r->handleMessage (*this);
33 }
34 
35 MessageListener::MessageListener() noexcept
36 {
37  // Are you trying to create a messagelistener before or after juce has been intialised??
38  JUCE_ASSERT_MESSAGE_MANAGER_EXISTS
39 }
40 
42 {
43  masterReference.clear();
44 }
45 
46 void MessageListener::postMessage (Message* const message) const
47 {
48  message->recipient = const_cast<MessageListener*> (this);
49  message->post();
50 }
51 
52 } // namespace juce
juce::Message::Message
Message() noexcept
Creates an uninitialised message.
Definition: juce_MessageListener.cpp:26
juce::MessageListener::~MessageListener
virtual ~MessageListener()
Destructor.
Definition: juce_MessageListener.cpp:41
juce::MessageListener::postMessage
void postMessage(Message *message) const
Sends a message to the message queue, for asynchronous delivery to this listener later on.
Definition: juce_MessageListener.cpp:46
juce::Message
The base class for objects that can be sent to a MessageListener.
Definition: juce_Message.h:47
juce::MessageListener
MessageListener subclasses can post and receive Message objects.
Definition: juce_MessageListener.h:38