Arduino Filters master
Filter library for Arduino
PrintStream.hpp
Go to the documentation of this file.
1
5#ifndef PrintStream_h
6#define PrintStream_h
7
10AH_DIAGNOSTIC_WERROR() // Enable errors on warnings
11
13#include <AH/Arduino-Wrapper.h> // Print
15
17
20
21typedef Print &manipulator(Print &);
22
23Print &endl(Print &printer);
24Print &flush(Print &printer);
25Print &hex(Print &printer);
26Print &bin(Print &printer);
27Print &dec(Print &printer);
28/* Print &oct(Print &printer); */
29Print &boolalpha(Print &printer);
30Print &noboolalpha(Print &printer);
31Print &leadingzeros(Print &printer);
32Print &noleadingzeros(Print &printer);
33Print &uppercase(Print &printer);
34Print &nouppercase(Print &printer);
35Print &showbase(Print &printer);
36Print &noshowbase(Print &printer);
37
38Print &operator<<(Print &printer, const __FlashStringHelper *s);
39#ifdef ARDUINO
40Print &operator<<(Print &printer, const String &s);
41#endif
42Print &operator<<(Print &printer, const char s[]);
43Print &operator<<(Print &printer, char c);
44Print &operator<<(Print &printer, unsigned char c);
45Print &operator<<(Print &printer, int i);
46Print &operator<<(Print &printer, unsigned int i);
47Print &operator<<(Print &printer, int8_t i);
48Print &operator<<(Print &printer, long i);
49Print &operator<<(Print &printer, unsigned long i);
50Print &operator<<(Print &printer, float f);
51Print &operator<<(Print &printer, double d);
52Print &operator<<(Print &printer, const Printable &p);
53Print &operator<<(Print &printer, bool b);
54
55Print &operator<<(Print &printer, manipulator pf);
56
57struct Setbase {
58 uint8_t M_base;
59};
60Setbase setbase(uint8_t base);
61Print &operator<<(Print &printer, Setbase f);
62
64 int M_n;
65};
67Print &operator<<(Print &printer, Setprecision f);
68
69struct Setbytesep {
71};
72Setbytesep setbytesep(char bytesep);
73Print &operator<<(Print &printer, Setbytesep f);
74
75struct HexDump {
76 HexDump(const uint8_t *data, size_t length)
77 : data(data), length(length) {}
78 const uint8_t *data;
79 size_t length;
80};
81
82Print &operator<<(Print &p, HexDump h);
83
85
86#ifndef ARDUINO
87
88#include <iomanip>
89#include <iostream>
90
91// TODO: check conflicts between Arduino version and C++ STL version
92using std::endl;
93// using std::setbase;
94// using std::setprecision;
95using std::boolalpha;
96using std::dec;
97using std::flush;
98using std::hex;
100using std::noshowbase;
101using std::nouppercase;
102using std::showbase;
103using std::uppercase;
104
105inline std::ostream &operator<<(std::ostream &os, uint8_t u) {
106 // I'm lazy, I should probably implement one for uint8_t to get the leading
107 // zeros right
108 return os << static_cast<unsigned short>(u);
109}
110
111inline std::ostream &operator<<(std::ostream &os,
112 const __FlashStringHelper *s) {
113 return os << reinterpret_cast<const char *>(s);
114}
115
116std::ostream &operator<<(std::ostream &p, HexDump h);
117
118#endif
119
121
123
124#endif // PrintStream_h
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
#define AH_DIAGNOSTIC_EXTERNAL_HEADER()
Definition: Warnings.hpp:37
#define AH_DIAGNOSTIC_POP()
Definition: Warnings.hpp:36
#define AH_DIAGNOSTIC_WERROR()
Definition: Warnings.hpp:35
Print & hex(Print &printer)
Definition: PrintStream.cpp:62
Print & bin(Print &printer)
Definition: PrintStream.cpp:72
Print & nouppercase(Print &printer)
Definition: PrintStream.cpp:40
Print & endl(Print &printer)
Definition: PrintStream.cpp:27
Print & uppercase(Print &printer)
Definition: PrintStream.cpp:35
Print & flush(Print &printer)
Definition: PrintStream.cpp:55
Print & showbase(Print &printer)
Definition: PrintStream.cpp:45
Print & manipulator(Print &)
Definition: PrintStream.hpp:21
Print & boolalpha(Print &printer)
Definition: PrintStream.cpp:82
Setbytesep setbytesep(char bytesep)
Print & leadingzeros(Print &printer)
Definition: PrintStream.cpp:91
Print & noshowbase(Print &printer)
Definition: PrintStream.cpp:50
Print & dec(Print &printer)
Definition: PrintStream.cpp:77
Print & noboolalpha(Print &printer)
Definition: PrintStream.cpp:86
Print & noleadingzeros(Print &printer)
Definition: PrintStream.cpp:95
Setbase setbase(uint8_t base)
Setprecision setprecision(int n)
Print & operator<<(Print &os, Quaternion e)
Printing.
Definition: Quaternion.cpp:28
const uint8_t * data
Definition: PrintStream.hpp:78
HexDump(const uint8_t *data, size_t length)
Definition: PrintStream.hpp:76
size_t length
Definition: PrintStream.hpp:79
uint8_t M_base
Definition: PrintStream.hpp:58
char M_bytesep
Definition: PrintStream.hpp:70