FortySevenEffects / arduino_midi_library

MIDI for Arduino
MIT License
1.56k stars 252 forks source link

chaining for all commands, callbacks and setters #247

Closed lathoub closed 2 years ago

lathoub commented 2 years ago

modified all commands, callbacks and setters with no return value (void) to return a reference to this.

example:

template<class Transport, class Settings, class Platform>
void MidiInterface<Transport, Settings, Platform>::begin(Channel inChannel)
{
...
}

becomes

template<class Transport, class Settings, class Platform>
MidiInterface<Transport, Settings, Platform>& MidiInterface<Transport, Settings, Platform>::begin(Channel inChannel)
{
...
    return *this;
}

this modif has no impact on existing code, and code size

coveralls commented 2 years ago

Coverage Status

Coverage decreased (-0.008%) to 99.624% when pulling 417beca1c70c8d21d54562d0753d91d11f71c7ea on chaining into b4daa697a9927c4f52d766f18dcd0f7ad305c3d8 on master.

lathoub commented 2 years ago

Not sure how to fix the platformIO errors

franky47 commented 2 years ago

It's under discussion here, I'll have a look, it's nothing related to this PR.

lathoub commented 2 years ago

added example on how to use command chaining with lambda functions