26 bool operator == (
IOModifier o) {
return mod == o.mod; }
27 bool operator != (
IOModifier o) {
return mod != o.mod; }
41 friend class BasicOStream;
47 virtual ~IOBackend() {}
49 virtual void write(
char const *str,
unsigned len) = 0;
52 void write(IOModifier m);
53 void write(
long long int c,
int len);
54 void write(
long long unsigned c,
int len);
55 void write(
long long unsigned c,
unsigned char base = 10,
56 unsigned char len = 0,
char pad =
' ');
74 BasicOStream(IOBackend *b)
78 void write(
char const *str,
unsigned len)
84 void write(
long long int c,
int len)
90 void write(
long long unsigned c,
unsigned char base = 10,
91 unsigned char len = 0,
char pad =
' ')
94 iob->write(c, base, len, pad);
97 void write(
long long unsigned c,
int len)
103 void write(IOModifier m)
109 IOBackend::Mode be_mode()
const
116 void be_mode(IOBackend::Mode m)
133 IONumFmt(
unsigned long long n,
unsigned char base = 10,
134 unsigned char len = 0,
char pad =
' ')
135 : n(n), base(base), len(len), pad(pad)
138 BasicOStream &print(BasicOStream &o)
const;
141 unsigned long long n;
142 unsigned char base, len;
146 inline IONumFmt n_hex(
unsigned long long n) {
return IONumFmt(n, 16); }
151 extern IOModifier
const hex;
156 extern IOModifier
const dec;
159 BasicOStream &IONumFmt::print(BasicOStream &o)
const
161 o.write(n, base, len, pad);
171operator << (L4::BasicOStream &s,
char const *
const str)
175 s.write(
"(NULL)", 6);
180 for (; str[l] != 0; l++)
188operator << (L4::BasicOStream &s,
signed short u)
190 s.write(
static_cast<long long signed>(u), -1);
196operator << (L4::BasicOStream &s,
signed u)
198 s.write(
static_cast<long long signed>(u), -1);
204operator << (L4::BasicOStream &s,
signed long u)
206 s.write(
static_cast<long long signed>(u), -1);
212operator << (L4::BasicOStream &s,
signed long long u)
220operator << (L4::BasicOStream &s,
unsigned short u)
222 s.write(
static_cast<long long unsigned>(u), -1);
228operator << (L4::BasicOStream &s,
unsigned u)
230 s.write(
static_cast<long long unsigned>(u), -1);
236operator << (L4::BasicOStream &s,
unsigned long u)
238 s.write(
static_cast<long long unsigned>(u), -1);
244operator << (L4::BasicOStream &s,
unsigned long long u)
252operator << (L4::BasicOStream &s,
void const *u)
254 long unsigned x =
reinterpret_cast<long unsigned>(u);
255 L4::IOBackend::Mode mode = s.be_mode();
257 s.write(
static_cast<long long unsigned>(x), -1);
272operator << (L4::BasicOStream &s,
char c)
280operator << (L4::BasicOStream &o, L4::IONumFmt
const &n)
281{
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.