OOStuBS - Technische Informatik II (TI-II)
2.4
|
Puffer für die Textausgabe. Mehr ...
#include <strbuf.h>
Geschützte Methoden | |
virtual void | flush ()=0 |
flush the content of the buffer to the screen | |
void | put (char c) |
insert a character into the buffer | |
Stringbuffer () | |
Default constructor setting the buffer empty. | |
virtual | ~Stringbuffer () |
Default destructor of Stringbuffer. |
Geschützte Attribute | |
char | buffer [BUFFERSIZE] |
buffer containing the characters | |
short | pos |
buffer pointer saving the position of the next insertion |
Puffer für die Textausgabe.
Die Klasse Stringbuffer implementiert einen Puffer, der die Zeichen für die Aufgabe auf dem Bildschirm oder einem anderen Ausgabegerät zwischenspeichert. Ist der Puffer voll oder wünscht der Programmierer explizit eine Ausgabe, so kann dies mittels der Methode flush() geschehen. Um die Unabhängigkeit vom Ausgabegerät zu erreichen, muss jede Unterklasse die Funktion flush() entsprechend implementieren und die gesetzten Attribute interpretieren. Da spätere Unterklassen auf alle Methoden und Variablen zugreifen müssen, werden alle Elemente mindestens als protected deklariert.
|
protected |
|
protectedvirtual |
Default destructor of Stringbuffer.
|
protectedpure virtual |
flush the content of the buffer to the screen
Method flush() prints the curent content of the buffer. It is called automaticaly as soon as the buffer is full or manualy if an output is forced. After printing the buffer content the buffer pointer is reseted. To enalbe the Stringbuffer to work with different output mechanisms the method has to be implemented in a subclass of Stringbuffer.
Implementiert in CGA_Stream und Log.
|
protected |
insert a character into the buffer
Method put() inserts a character into the buffer. If the buffer is full after the insertion the buffer has to be emptied by calling the method flush().
c | character to be inserted into the buffer |
Definiert in Zeile 19 der Datei strbuf.cc.
|
protected |
|
protected |