1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Made ListenerList.callExcluding take a pointer argument

This commit is contained in:
tpoole 2017-05-02 22:09:39 +01:00
parent c94550e4cd
commit 2a189100d7
3 changed files with 31 additions and 34 deletions

View file

@ -110,7 +110,7 @@ public:
}
template <typename... Args>
void callExcludingHelper (ListenerBase& listenerToExclude,
void callExcludingHelper (ListenerBase* listenerToExclude,
std::vector<int>& expectedCounterValues)
{
counter = 0;
@ -125,7 +125,7 @@ public:
}
template<typename T, typename... Args>
void callExcludingHelper (ListenerBase& listenerToExclude,
void callExcludingHelper (ListenerBase* listenerToExclude,
std::vector<int>& expectedCounterValues, T first, Args... args)
{
const int expected = expectedCounterValues[sizeof... (args) + 1];
@ -165,7 +165,7 @@ public:
for (int i = 1; i < 8; ++i)
expectedCounterValues.push_back (i);
callExcludingHelper (listener2, expectedCounterValues, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
callExcludingHelper (&listener2, expectedCounterValues, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
}
int counter = 0;

View file

@ -142,7 +142,7 @@ public:
/** Calls a member function, with no parameters, on all but the specified listener in the list.
This can be useful if the caller is also a listener and needs to exclude itself.
*/
void callExcluding (ListenerClass& listenerToExclude, void (ListenerClass::*callbackFunction) ())
void callExcluding (ListenerClass* listenerToExclude, void (ListenerClass::*callbackFunction) ())
{
callCheckedExcluding (listenerToExclude,
static_cast<const DummyBailOutChecker&> (DummyBailOutChecker()), callbackFunction);
@ -164,12 +164,12 @@ public:
description for info about writing a bail-out checker.
*/
template <class BailOutCheckerType>
void callCheckedExcluding (ListenerClass& listenerToExclude,
void callCheckedExcluding (ListenerClass* listenerToExclude,
const BailOutCheckerType& bailOutChecker,
void (ListenerClass::*callbackFunction) ())
{
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
if (iter.getListener() != &listenerToExclude)
if (iter.getListener() != listenerToExclude)
(iter.getListener()->*callbackFunction) ();
}
@ -186,11 +186,11 @@ public:
This can be useful if the caller is also a listener and needs to exclude itself.
*/
template <LL_TEMPLATE(1)>
void callExcluding (ListenerClass& listenerToExclude,
void callExcluding (ListenerClass* listenerToExclude,
void (ListenerClass::*callbackFunction) (P1), LL_PARAM(1))
{
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
if (iter.getListener() != &listenerToExclude)
if (iter.getListener() != listenerToExclude)
(iter.getListener()->*callbackFunction) (param1);
}
@ -211,13 +211,13 @@ public:
exclude itself. See the class description for info about writing a bail-out checker.
*/
template <class BailOutCheckerType, LL_TEMPLATE(1)>
void callCheckedExcluding (ListenerClass& listenerToExclude,
void callCheckedExcluding (ListenerClass* listenerToExclude,
const BailOutCheckerType& bailOutChecker,
void (ListenerClass::*callbackFunction) (P1),
LL_PARAM(1))
{
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
if (iter.getListener() != &listenerToExclude)
if (iter.getListener() != listenerToExclude)
(iter.getListener()->*callbackFunction) (param1);
}
@ -235,12 +235,12 @@ public:
This can be useful if the caller is also a listener and needs to exclude itself.
*/
template <LL_TEMPLATE(1), LL_TEMPLATE(2)>
void callExcluding (ListenerClass& listenerToExclude,
void callExcluding (ListenerClass* listenerToExclude,
void (ListenerClass::*callbackFunction) (P1, P2),
LL_PARAM(1), LL_PARAM(2))
{
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
if (iter.getListener() != &listenerToExclude)
if (iter.getListener() != listenerToExclude)
(iter.getListener()->*callbackFunction) (param1, param2);
}
@ -261,13 +261,13 @@ public:
exclude itself. See the class description for info about writing a bail-out checker.
*/
template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2)>
void callCheckedExcluding (ListenerClass& listenerToExclude,
void callCheckedExcluding (ListenerClass* listenerToExclude,
const BailOutCheckerType& bailOutChecker,
void (ListenerClass::*callbackFunction) (P1, P2),
LL_PARAM(1), LL_PARAM(2))
{
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
if (iter.getListener() != &listenerToExclude)
if (iter.getListener() != listenerToExclude)
(iter.getListener()->*callbackFunction) (param1, param2);
}
@ -285,12 +285,12 @@ public:
This can be useful if the caller is also a listener and needs to exclude itself.
*/
template <LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3)>
void callExcluding (ListenerClass& listenerToExclude,
void callExcluding (ListenerClass* listenerToExclude,
void (ListenerClass::*callbackFunction) (P1, P2, P3),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3))
{
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
if (iter.getListener() != &listenerToExclude)
if (iter.getListener() != listenerToExclude)
(iter.getListener()->*callbackFunction) (param1, param2, param3);
}
@ -311,13 +311,13 @@ public:
exclude itself. See the class description for info about writing a bail-out checker.
*/
template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3)>
void callCheckedExcluding (ListenerClass& listenerToExclude,
void callCheckedExcluding (ListenerClass* listenerToExclude,
const BailOutCheckerType& bailOutChecker,
void (ListenerClass::*callbackFunction) (P1, P2, P3),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3))
{
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
if (iter.getListener() != &listenerToExclude)
if (iter.getListener() != listenerToExclude)
(iter.getListener()->*callbackFunction) (param1, param2, param3);
}
@ -335,12 +335,12 @@ public:
This can be useful if the caller is also a listener and needs to exclude itself.
*/
template <LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4)>
void callExcluding (ListenerClass& listenerToExclude,
void callExcluding (ListenerClass* listenerToExclude,
void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4))
{
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
if (iter.getListener() != &listenerToExclude)
if (iter.getListener() != listenerToExclude)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
}
@ -361,13 +361,13 @@ public:
exclude itself. See the class description for info about writing a bail-out checker.
*/
template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4)>
void callCheckedExcluding (ListenerClass& listenerToExclude,
void callCheckedExcluding (ListenerClass* listenerToExclude,
const BailOutCheckerType& bailOutChecker,
void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4))
{
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
if (iter.getListener() != &listenerToExclude)
if (iter.getListener() != listenerToExclude)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
}
@ -385,12 +385,12 @@ public:
This can be useful if the caller is also a listener and needs to exclude itself.
*/
template <LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4), LL_TEMPLATE(5)>
void callExcluding (ListenerClass& listenerToExclude,
void callExcluding (ListenerClass* listenerToExclude,
void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5))
{
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
if (iter.getListener() != &listenerToExclude)
if (iter.getListener() != listenerToExclude)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
}
@ -411,13 +411,13 @@ public:
exclude itself. See the class description for info about writing a bail-out checker.
*/
template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4), LL_TEMPLATE(5)>
void callCheckedExcluding (ListenerClass& listenerToExclude,
void callCheckedExcluding (ListenerClass* listenerToExclude,
const BailOutCheckerType& bailOutChecker,
void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5))
{
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
if (iter.getListener() != &listenerToExclude)
if (iter.getListener() != listenerToExclude)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
}
@ -435,12 +435,12 @@ public:
This can be useful if the caller is also a listener and needs to exclude itself.
*/
template <LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4), LL_TEMPLATE(5), LL_TEMPLATE(6)>
void callExcluding (ListenerClass& listenerToExclude,
void callExcluding (ListenerClass* listenerToExclude,
void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5, P6),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5), LL_PARAM(6))
{
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
if (iter.getListener() != &listenerToExclude)
if (iter.getListener() != listenerToExclude)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5, param6);
}
@ -461,13 +461,13 @@ public:
exclude itself. See the class description for info about writing a bail-out checker.
*/
template <class BailOutCheckerType, LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4), LL_TEMPLATE(5), LL_TEMPLATE(6)>
void callCheckedExcluding (ListenerClass& listenerToExclude,
void callCheckedExcluding (ListenerClass* listenerToExclude,
const BailOutCheckerType& bailOutChecker,
void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5, P6),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5), LL_PARAM(6))
{
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
if (iter.getListener() != &listenerToExclude)
if (iter.getListener() != listenerToExclude)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5, param6);
}

View file

@ -96,10 +96,7 @@ public:
{
ValueTree tree (this);
if (listenerToExclude == nullptr)
callListenersForAllParents ([&] (ListenerList<Listener>& list) { list.call (&ValueTree::Listener::valueTreePropertyChanged, tree, property); });
else
callListenersForAllParents ([&] (ListenerList<Listener>& list) { list.callExcluding (*listenerToExclude, &ValueTree::Listener::valueTreePropertyChanged, tree, property); });
callListenersForAllParents ([&] (ListenerList<Listener>& list) { list.callExcluding (listenerToExclude, &ValueTree::Listener::valueTreePropertyChanged, tree, property); });
}
void sendChildAddedMessage (ValueTree child)