37 bool operator == (
IOModifier o) {
return mod == o.mod; }
38 bool operator != (
IOModifier o) {
return mod != o.mod; }
52 friend class BasicOStream;
58 virtual ~IOBackend() {}
60 virtual void write(
char const *str,
unsigned len) = 0;
63 void write(IOModifier m);
64 void write(
long long int c,
int len);
65 void write(
long long unsigned c,
int len);
66 void write(
long long unsigned c,
unsigned char base = 10,
67 unsigned char len = 0,
char pad =
' ');
85 BasicOStream(IOBackend *b)
89 void write(
char const *str,
unsigned len)
95 void write(
long long int c,
int len)
101 void write(
long long unsigned c,
unsigned char base = 10,
102 unsigned char len = 0,
char pad =
' ')
105 iob->write(c, base, len, pad);
108 void write(
long long unsigned c,
int len)
114 void write(IOModifier m)
120 IOBackend::Mode be_mode()
const
127 void be_mode(IOBackend::Mode m)
144 IONumFmt(
unsigned long long n,
unsigned char base = 10,
145 unsigned char len = 0,
char pad =
' ')
146 : n(n), base(base), len(len), pad(pad)
149 BasicOStream &print(BasicOStream &o)
const;
152 unsigned long long n;
153 unsigned char base, len;
157 inline IONumFmt n_hex(
unsigned long long n) {
return IONumFmt(n, 16); }
162 extern IOModifier
const hex;
167 extern IOModifier
const dec;
170 BasicOStream &IONumFmt::print(BasicOStream &o)
const
172 o.write(n, base, len, pad);
182operator << (L4::BasicOStream &s,
char const *
const str)
186 s.write(
"(NULL)", 6);
191 for (; str[l] != 0; l++)
199operator << (L4::BasicOStream &s,
signed short u)
201 s.write(
static_cast<long long signed>(u), -1);
207operator << (L4::BasicOStream &s,
signed u)
209 s.write(
static_cast<long long signed>(u), -1);
215operator << (L4::BasicOStream &s,
signed long u)
217 s.write(
static_cast<long long signed>(u), -1);
223operator << (L4::BasicOStream &s,
signed long long u)
231operator << (L4::BasicOStream &s,
unsigned short u)
233 s.write(
static_cast<long long unsigned>(u), -1);
239operator << (L4::BasicOStream &s,
unsigned u)
241 s.write(
static_cast<long long unsigned>(u), -1);
247operator << (L4::BasicOStream &s,
unsigned long u)
249 s.write(
static_cast<long long unsigned>(u), -1);
255operator << (L4::BasicOStream &s,
unsigned long long u)
263operator << (L4::BasicOStream &s,
void const *u)
265 long unsigned x =
reinterpret_cast<long unsigned>(u);
266 L4::IOBackend::Mode mode = s.be_mode();
268 s.write(
static_cast<long long unsigned>(x), -1);
283operator << (L4::BasicOStream &s,
char c)
291operator << (L4::BasicOStream &o, L4::IONumFmt
const &n)
292{
return n.print(o); }
Modifier class for the IO stream.
L4 low-level kernel interface.
IOModifier const dec
Modifies the stream to print numbers as decimal values.
IOModifier const hex
Modifies the stream to print numbers as hexadecimal values.