118 template <
typename Callback>
119 void call (Callback&& callback)
121 typename ArrayType::ScopedLockType lock (listeners.
getLock());
124 callback (*
iter.getListener());
130 template <
typename Callback>
133 typename ArrayType::ScopedLockType lock (listeners.
getLock());
137 auto*
l =
iter.getListener();
147 template <
typename Callback,
typename BailOutCheckerType>
150 typename ArrayType::ScopedLockType lock (listeners.
getLock());
153 callback (*
iter.getListener());
160 template <
typename Callback,
typename BailOutCheckerType>
165 typename ArrayType::ScopedLockType lock (listeners.
getLock());
169 auto*
l =
iter.getListener();
182 bool shouldBailOut()
const noexcept {
return false; }
190 template <
class BailOutCheckerType,
class ListType>
219 typename ListType::ListenerType* getListener()
const noexcept
229 JUCE_DECLARE_NON_COPYABLE (
Iterator)
241 void callExcluding (ListenerClass* listenerToExclude,
void (ListenerClass::*callbackFunction) ())
243 callExcluding (listenerToExclude, [=] (ListenerClass& l) { (l.*callbackFunction)(); });
246 template <
class BailOutCheckerType>
247 void callChecked (
const BailOutCheckerType& bailOutChecker,
void (ListenerClass::*callbackFunction) ())
249 callChecked (bailOutChecker, [=] (ListenerClass& l) { (l.*callbackFunction)(); });
252 template <
class BailOutCheckerType>
254 const BailOutCheckerType& bailOutChecker,
255 void (ListenerClass::*callbackFunction) ())
257 callCheckedExcluding (listenerToExclude, bailOutChecker, [=] (ListenerClass& l) { (l.*callbackFunction)(); });
260 template <
typename... MethodArgs,
typename... Args>
261 void call (
void (ListenerClass::*callbackFunction) (MethodArgs...), Args&&... args)
263 typename ArrayType::ScopedLockType lock (listeners.
getLock());
265 for (Iterator<DummyBailOutChecker, ThisType> iter (*
this); iter.next();)
266 (iter.getListener()->*callbackFunction) (
static_cast<typename TypeHelpers::ParameterType<Args>::type
> (args)...);
269 template <
typename... MethodArgs,
typename... Args>
271 void (ListenerClass::*callbackFunction) (MethodArgs...),
274 typename ArrayType::ScopedLockType lock (listeners.
getLock());
276 for (Iterator<DummyBailOutChecker, ThisType> iter (*
this); iter.next();)
277 if (iter.getListener() != listenerToExclude)
278 (iter.getListener()->*callbackFunction) (
static_cast<typename TypeHelpers::ParameterType<Args>::type
> (args)...);
281 template <
typename BailOutCheckerType,
typename... MethodArgs,
typename... Args>
282 void callChecked (
const BailOutCheckerType& bailOutChecker,
283 void (ListenerClass::*callbackFunction) (MethodArgs...),
286 typename ArrayType::ScopedLockType lock (listeners.
getLock());
288 for (Iterator<BailOutCheckerType, ThisType> iter (*
this); iter.next (bailOutChecker);)
289 (iter.getListener()->*callbackFunction) (
static_cast<typename TypeHelpers::ParameterType<Args>::type
> (args)...);
292 template <
typename BailOutCheckerType,
typename... MethodArgs,
typename... Args>
294 const BailOutCheckerType& bailOutChecker,
295 void (ListenerClass::*callbackFunction) (MethodArgs...),
298 typename ArrayType::ScopedLockType lock (listeners.
getLock());
300 for (Iterator<BailOutCheckerType, ThisType> iter (*
this); iter.next (bailOutChecker);)
301 if (iter.getListener() != listenerToExclude)
302 (iter.getListener()->*callbackFunction) (
static_cast<typename TypeHelpers::ParameterType<Args>::type
> (args)...);