StuBS
|
This file contains the OutputStream. More...
#include "stringbuffer.h"
Classes | |
class | OutputStream |
The class OutputStream corresponds, essentially, to the class ostream from the C++ IO-Stream library. More... | |
Functions | |
OutputStream & | flush (OutputStream &os) |
Enforces a buffer flush. More... | |
OutputStream & | endl (OutputStream &os) |
Prints a newline character to the stream and issues a buffer flush. More... | |
OutputStream & | bin (OutputStream &os) |
Print subsequent numbers in binary form. More... | |
OutputStream & | oct (OutputStream &os) |
Print subsequent numbers in octal form. More... | |
OutputStream & | dec (OutputStream &os) |
Print subsequent numbers in decimal form. More... | |
OutputStream & | hex (OutputStream &os) |
Print subsequent numbers in hex form. More... | |
This file contains the OutputStream.
Along with the class OutputStream itself, this file contains definitions for the manipulators hex, dec, oct, and bin, which are used for changing the radix, and endl for signaling the end of the current line.
kout << "a = " << dec << a << " is hexadecimal " << hex << a << endl;
should, at first, print the value stored in decimal and then in hexadecimal form, followed by a line break. The intended properties can be realized by implementing hex, dec, oct, bin, and endl as functions (i.e., they are, in particular, not methods of OutputStream) that take (as first parameter) and return a reference to an OutputStream object. When compiling the expression show above, the method OutputStream& OutputStream::operator<< ((f) (OutputStream&))
is chosen when one of the functions hex, dec, oct, bin, or endl is streamed an OutputStream, which finally will execute the passed function.OutputStream & bin | ( | OutputStream & | os | ) |
Print subsequent numbers in binary form.
os | Reference to stream to be modified. |
OutputStream & dec | ( | OutputStream & | os | ) |
Print subsequent numbers in decimal form.
os | Reference to stream to be modified. |
OutputStream & endl | ( | OutputStream & | os | ) |
Prints a newline character to the stream and issues a buffer flush.
os | Reference to stream to be modified. |
OutputStream & flush | ( | OutputStream & | os | ) |
Enforces a buffer flush.
os | Reference to stream to be flushed. |
OutputStream & hex | ( | OutputStream & | os | ) |
Print subsequent numbers in hex form.
os | Reference to stream to be modified. |
OutputStream & oct | ( | OutputStream & | os | ) |
Print subsequent numbers in octal form.
os | Reference to stream to be modified. |