LCOV - code coverage report
Current view: top level - src/MIDI_Parsers - StreamPuller.hpp (source / functions) Coverage Total Hit
Test: 73449d9b107c772cf65493691543348214e5d5eb Lines: 100.0 % 6 6
Test Date: 2026-06-06 17:44:35 Functions: 100.0 % 2 2
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 2.4-beta