StuBS
|
The class Stringbuffer composes single characters into a longer text that can be processed on block. More...
#include <stringbuffer.h>
Public Member Functions | |
virtual | ~Stringbuffer () |
Destructor (nothing to do here) | |
Protected Member Functions | |
Stringbuffer () | |
Constructor; Marks the buffer as empty. | |
void | put (char c) |
Inserts a character into the buffer. More... | |
virtual void | flush ()=0 |
Flush the buffer contents. More... | |
Protected Attributes | |
char | buffer [80] |
buffer containing characters that will be printed upon flush() | |
long unsigned | pos |
current position in the buffer | |
The class Stringbuffer composes single characters into a longer text that can be processed on block.
To make Stringbuffer as versatile as possible, the class does make assumptions about neither the underlying hardware, nor the meaning of "processing". When flush() is called (i.e., either on explicit request or once the buffer is full). To be hardware independent, flush() is to be implemented by the derived classes.
|
protectedpure virtual |
Flush the buffer contents.
This method is to be defined in derived classes, as only those know how to print characters. flush() is required to reset the position pos.
Implemented in OutputStream, FileOut, ConsoleOut, TextStream, SerialStream, CopyStream, and GraphicsStream.
|
protected |
Inserts a character into the buffer.
Once the buffer is full, a call to flush() will be issued and thereby clearing the buffer.
c | Char to be added |