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

Added an extra method to ListenerList. Handled zero-length binary data in var class.

This commit is contained in:
jules 2013-04-14 10:14:24 +01:00
parent d096a78d85
commit c8e09aba67
3 changed files with 31 additions and 3 deletions

View file

@ -676,8 +676,13 @@ var var::readFromStream (InputStream& input)
case varMarker_Binary:
{
MemoryBlock mb (numBytes - 1);
const int numRead = input.read (mb.getData(), numBytes - 1);
mb.setSize (numRead);
if (numBytes > 1)
{
const int numRead = input.read (mb.getData(), numBytes - 1);
mb.setSize (numRead);
}
return var (mb);
}

View file

@ -263,6 +263,27 @@ public:
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
}
//==============================================================================
/** Calls a member function on each listener in the list, with 5 parameters. */
template <LL_TEMPLATE(1), LL_TEMPLATE(2), LL_TEMPLATE(3), LL_TEMPLATE(4), LL_TEMPLATE(5), LL_TEMPLATE(6)>
void call (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();)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5, param6);
}
/** Calls a member function on each listener in the list, with 5 parameters and a bail-out-checker.
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 callChecked (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);)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5, param6);
}
//==============================================================================
/** A dummy bail-out checker that always returns false.

View file

@ -201,7 +201,9 @@ Colour::Colour (const uint8 red, const uint8 green, const uint8 blue, const floa
Colour Colour::fromFloatRGBA (const float red, const float green, const float blue, const float alpha) noexcept
{
return Colour (ColourHelpers::floatToUInt8 (red), ColourHelpers::floatToUInt8 (green), ColourHelpers::floatToUInt8 (blue), alpha);
return Colour (ColourHelpers::floatToUInt8 (red),
ColourHelpers::floatToUInt8 (green),
ColourHelpers::floatToUInt8 (blue), alpha);
}
Colour::Colour (const float hue, const float saturation, const float brightness, const float alpha) noexcept