LCOV - code coverage report
Current view: top level - src/MIDI_Parsers - StreamPuller.hpp (source / functions) Hit Total Coverage
Test: b8a30b4b7040ae1abf162fd0a258beaa2de43626 Lines: 6 6 100.0 %
Date: 2024-12-21 21:28:55 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <AH/Arduino-Wrapper.h> // Stream
       4             : #include <Settings/NamespaceSettings.hpp>
       5             : 
       6             : BEGIN_CS_NAMESPACE
       7             : 
       8             : /**
       9             :  * @brief   Helper that pulls bytes out of an Arduino stream.
      10             :  * 
      11             :  * @ingroup MIDIParsers
      12             :  */
      13             : class StreamPuller {
      14             :   public:
      15          31 :     StreamPuller(Stream &stream) : stream(stream) {}
      16             : 
      17             :     /// Pull a byte out of the stream.
      18             :     /// @param[out] c
      19             :     ///             A new character from the stream (if available).
      20             :     /// @return True if a character was available, false otherwise.
      21         351 :     bool pull(uint8_t &c) {
      22         351 :         int read = stream.read();
      23         351 :         if (read >= 0)
      24         346 :             c = read;
      25         351 :         return read >= 0;
      26             :     }
      27             : 
      28             :     Stream &stream;
      29             : };
      30             : 
      31             : END_CS_NAMESPACE

Generated by: LCOV version 1.15