LCOV - code coverage report
Current view: top level - src/AH/PrintStream - PrintStream.hpp (source / functions) Hit Total Coverage
Test: 90a1b9beff85a60dc6ebcea034a947a845e56960 Lines: 4 4 100.0 %
Date: 2019-11-30 15:53:32 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /**
       2             :  * @brief   [PrintStream library](https://github.com/tttapa/Arduino-PrintStream/blob/6a9e0d365be0b3d84187daa2a8a7bda8d541472e/src/PrintStream.h)
       3             :  */
       4             : 
       5             : #ifndef PrintStream_h
       6             : #define PrintStream_h
       7             : 
       8             : #include <AH/Settings/Warnings.hpp>
       9             : AH_DIAGNOSTIC_WERROR() // Enable errors on warnings
      10             : 
      11             : AH_DIAGNOSTIC_EXTERNAL_HEADER()
      12             : #include <Arduino.h> // Print
      13             : AH_DIAGNOSTIC_POP()
      14             : 
      15             : /// @addtogroup  AH_PrintStream
      16             : /// @{
      17             : 
      18             : typedef Print &manipulator(Print &);
      19             : 
      20             : Print &endl(Print &printer);
      21             : Print &flush(Print &printer);
      22             : Print &hex(Print &printer);
      23             : Print &bin(Print &printer);
      24             : Print &dec(Print &printer);
      25             : /* Print &oct(Print &printer); */
      26             : Print &boolalpha(Print &printer);
      27             : Print &noboolalpha(Print &printer);
      28             : Print &leadingzeros(Print &printer);
      29             : Print &noleadingzeros(Print &printer);
      30             : Print &uppercase(Print &printer);
      31             : Print &nouppercase(Print &printer);
      32             : Print &showbase(Print &printer);
      33             : Print &noshowbase(Print &printer);
      34             : 
      35             : Print &operator<<(Print &printer, const __FlashStringHelper *s);
      36             : #ifdef ARDUINO
      37             : Print &operator<<(Print &printer, const String &s);
      38             : #endif
      39             : Print &operator<<(Print &printer, const char s[]);
      40             : Print &operator<<(Print &printer, char c);
      41             : Print &operator<<(Print &printer, unsigned char c);
      42             : Print &operator<<(Print &printer, int i);
      43             : Print &operator<<(Print &printer, unsigned int i);
      44             : Print &operator<<(Print &printer, int8_t i);
      45             : Print &operator<<(Print &printer, long i);
      46             : Print &operator<<(Print &printer, unsigned long i);
      47             : Print &operator<<(Print &printer, double d);
      48             : Print &operator<<(Print &printer, const Printable &p);
      49             : Print &operator<<(Print &printer, bool b);
      50             : 
      51             : Print &operator<<(Print &printer, manipulator pf);
      52             : 
      53             : struct Setbase {
      54             :     uint8_t M_base;
      55             : };
      56             : Setbase setbase(uint8_t base);
      57             : Print &operator<<(Print &printer, Setbase f);
      58             : 
      59             : struct Setprecision {
      60             :     int M_n;
      61             : };
      62             : Setprecision setprecision(int n);
      63             : Print &operator<<(Print &printer, Setprecision f);
      64             : 
      65             : struct Setbytesep {
      66             :     char M_bytesep;
      67             : };
      68             : Setbytesep setbytesep(char bytesep);
      69             : Print &operator<<(Print &printer, Setbytesep f);
      70             : 
      71             : /// @}
      72             : 
      73             : #ifndef ARDUINO
      74             : 
      75             : #include <iomanip>
      76             : #include <iostream>
      77             : 
      78             : // TODO: check conflicts between Arduino version and C++ STL version
      79             : using std::endl;
      80             : // using std::setbase;
      81             : // using std::setprecision;
      82             : using std::boolalpha;
      83             : using std::dec;
      84             : using std::flush;
      85             : using std::hex;
      86             : using std::noboolalpha;
      87             : using std::noshowbase;
      88             : using std::nouppercase;
      89             : using std::showbase;
      90             : using std::uppercase;
      91             : 
      92           4 : inline std::ostream &operator<<(std::ostream &os, uint8_t u) {
      93             :     // I'm lazy, I should probably implement one for uint8_t to get the leading
      94             :     // zeros right
      95           4 :     return os << static_cast<unsigned short>(u);
      96             : }
      97             : 
      98          40 : inline std::ostream &operator<<(std::ostream &os,
      99             :                                 const __FlashStringHelper *s) {
     100          40 :     return os << reinterpret_cast<const char *>(s);
     101             : }
     102             : 
     103             : #endif
     104             : 
     105             : AH_DIAGNOSTIC_POP()
     106             : 
     107             : #endif // PrintStream_h

Generated by: LCOV version 1.14-5-g4ff2ed6