Control Surface main
MIDI Control Surface 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) : data(data), length(length) {}
77 template <size_t N>
78 explicit HexDump(const uint8_t (&data)[N]) : HexDump {data, N} {}
79 const uint8_t *data;
80 size_t length;
81};
82
83Print &operator<<(Print &p, HexDump h);
84
86
87#ifndef ARDUINO
88
89#include <iomanip>
90#include <iostream>
91
92// TODO: check conflicts between Arduino version and C++ STL version
93using std::endl;
94// using std::setbase;
95// using std::setprecision;
96using std::boolalpha;
97using std::dec;
98using std::flush;
99using std::hex;
100using std::noboolalpha;
101using std::noshowbase;
102using std::nouppercase;
103using std::showbase;
104using std::uppercase;
105
106inline std::ostream &operator<<(std::ostream &os, uint8_t u) {
107 // I'm lazy, I should probably implement one for uint8_t to get the leading
108 // zeros right
109 return os << static_cast<unsigned short>(u);
110}
111
112inline std::ostream &operator<<(std::ostream &os,
113 const __FlashStringHelper *s) {
114 return os << reinterpret_cast<const char *>(s);
115}
116
117std::ostream &operator<<(std::ostream &p, HexDump h);
118
119#endif
120
122
124
125#include <Settings/NamespaceSettings.hpp>
126
128using AH::operator<<;
129using AH::manipulator;
130using AH::endl;
131using AH::flush;
132using AH::hex;
133using AH::bin;
134using AH::dec;
135using AH::boolalpha;
136using AH::noboolalpha;
137using AH::leadingzeros;
139using AH::uppercase;
140using AH::nouppercase;
141using AH::showbase;
142using AH::noshowbase;
143using AH::setbase;
144using AH::setprecision;
145using AH::setbytesep;
147
148#endif // PrintStream_h
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
#define AH_DIAGNOSTIC_EXTERNAL_HEADER()
Definition: Warnings.hpp:38
#define AH_DIAGNOSTIC_POP()
Definition: Warnings.hpp:37
#define AH_DIAGNOSTIC_WERROR()
Definition: Warnings.hpp:36
uint8_t M_base
Definition: PrintStream.hpp:58
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:79
HexDump(const uint8_t *data, size_t length)
Definition: PrintStream.hpp:76
HexDump(const uint8_t(&data)[N])
Definition: PrintStream.hpp:78
size_t length
Definition: PrintStream.hpp:80