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;
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)
90 {
if(iob) iob->write(str,len); }
92 void write(
long long int c,
int len)
93 {
if(iob) iob->write(c,len); }
95 void write(
long long unsigned c,
unsigned char base = 10,
96 unsigned char len = 0,
char pad =
' ')
97 {
if(iob) iob->write(c, base, len, pad); }
99 void write(
long long unsigned c,
int len)
100 {
if(iob) iob->write(c,len); }
103 {
if(iob) iob->write(m); }
105 IOBackend::Mode be_mode()
const 106 {
if(iob)
return iob->mode();
return 0; }
108 void be_mode(IOBackend::Mode m)
109 {
if(iob) iob->mode(m); }
123 IONumFmt(
unsigned long long n,
unsigned char base = 10,
124 unsigned char len = 0,
char pad =
' ')
125 : n(n), base(base), len(len), pad(pad)
128 BasicOStream &print(BasicOStream &o)
const;
131 unsigned long long n;
132 unsigned char base, len;
136 inline IONumFmt n_hex(
unsigned long long n) {
return IONumFmt(n, 16); }
149 BasicOStream &IONumFmt::print(BasicOStream &o)
const 151 o.write(n, base, len, pad);
162 operator << (L4::BasicOStream &s,
char const *
const str)
166 s.write(
"(NULL)", 6);
171 for(; str[l]!=0; l++)
179 operator << (L4::BasicOStream &s,
signed short u)
181 s.write((
long long signed)u,-1);
187 operator << (L4::BasicOStream &s,
signed u)
189 s.write((
long long signed)u,-1);
195 operator << (L4::BasicOStream &s,
signed long u)
197 s.write((
long long signed)u,-1);
203 operator << (L4::BasicOStream &s,
signed long long u)
211 operator << (L4::BasicOStream &s,
unsigned short u)
213 s.write((
long long unsigned)u,-1);
219 operator << (L4::BasicOStream &s,
unsigned u)
221 s.write((
long long unsigned)u,-1);
227 operator << (L4::BasicOStream &s,
unsigned long u)
229 s.write((
long long unsigned)u,-1);
235 operator << (L4::BasicOStream &s,
unsigned long long u)
243 operator << (L4::BasicOStream &s,
void const *u)
245 long unsigned x = (
long unsigned)u;
246 L4::IOBackend::Mode mode = s.be_mode();
248 s.write((
long long unsigned)x,-1);
263 operator << (L4::BasicOStream &s,
char c)
273 operator << (L4::BasicOStream &o, L4::IONumFmt
const &n)
274 {
return n.print(o); }
IOModifier const dec
Modifies the stream to print numbers as decimal values.
Modifier class for the IO stream.
L4 low-level kernel interface.
IOModifier const hex
Modifies the stream to print numbers as hexadecimal values.