Control Surface new-input
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 
10 AH_DIAGNOSTIC_WERROR() // Enable errors on warnings
11 
13 #include <AH/Arduino-Wrapper.h> // Print
15 
17 
20 
21 typedef Print &manipulator(Print &);
22 
23 Print &endl(Print &printer);
24 Print &flush(Print &printer);
25 Print &hex(Print &printer);
26 Print &bin(Print &printer);
27 Print &dec(Print &printer);
28 /* Print &oct(Print &printer); */
29 Print &boolalpha(Print &printer);
30 Print &noboolalpha(Print &printer);
31 Print &leadingzeros(Print &printer);
32 Print &noleadingzeros(Print &printer);
33 Print &uppercase(Print &printer);
34 Print &nouppercase(Print &printer);
35 Print &showbase(Print &printer);
36 Print &noshowbase(Print &printer);
37 
38 Print &operator<<(Print &printer, const __FlashStringHelper *s);
39 #ifdef ARDUINO
40 Print &operator<<(Print &printer, const String &s);
41 #endif
42 Print &operator<<(Print &printer, const char s[]);
43 Print &operator<<(Print &printer, char c);
44 Print &operator<<(Print &printer, unsigned char c);
45 Print &operator<<(Print &printer, int i);
46 Print &operator<<(Print &printer, unsigned int i);
47 Print &operator<<(Print &printer, int8_t i);
48 Print &operator<<(Print &printer, long i);
49 Print &operator<<(Print &printer, unsigned long i);
50 Print &operator<<(Print &printer, float f);
51 Print &operator<<(Print &printer, double d);
52 Print &operator<<(Print &printer, const Printable &p);
53 Print &operator<<(Print &printer, bool b);
54 
55 Print &operator<<(Print &printer, manipulator pf);
56 
57 struct Setbase {
58  uint8_t M_base;
59 };
60 Setbase setbase(uint8_t base);
61 Print &operator<<(Print &printer, Setbase f);
62 
63 struct Setprecision {
64  int M_n;
65 };
67 Print &operator<<(Print &printer, Setprecision f);
68 
69 struct Setbytesep {
70  char M_bytesep;
71 };
72 Setbytesep setbytesep(char bytesep);
73 Print &operator<<(Print &printer, Setbytesep f);
74 
75 struct 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 
82 Print &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
92 using std::endl;
93 // using std::setbase;
94 // using std::setprecision;
95 using std::boolalpha;
96 using std::dec;
97 using std::flush;
98 using std::hex;
99 using std::noboolalpha;
100 using std::noshowbase;
101 using std::nouppercase;
102 using std::showbase;
103 using std::uppercase;
104 
105 inline 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 
111 inline std::ostream &operator<<(std::ostream &os,
112  const __FlashStringHelper *s) {
113  return os << reinterpret_cast<const char *>(s);
114 }
115 
116 std::ostream &operator<<(std::ostream &p, HexDump h);
117 
118 #endif
119 
121 
123 
124 #include <Settings/NamespaceSettings.hpp>
125 
127 using AH::operator<<;
128 using AH::manipulator;
129 using AH::endl;
130 using AH::flush;
131 using AH::hex;
132 using AH::bin;
133 using AH::dec;
134 using AH::boolalpha;
135 using AH::noboolalpha;
136 using AH::leadingzeros;
137 using AH::noleadingzeros;
138 using AH::uppercase;
139 using AH::nouppercase;
140 using AH::showbase;
141 using AH::noshowbase;
142 using AH::setbase;
143 using AH::setprecision;
144 using AH::setbytesep;
146 
147 #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:37
#define AH_DIAGNOSTIC_POP()
Definition: Warnings.hpp:36
#define AH_DIAGNOSTIC_WERROR()
Definition: Warnings.hpp:35
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 & 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 & manipulator(Print &)
Definition: PrintStream.hpp:21
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