StuBS
|
Output text (form different data type sources) on screen in text mode. More...
#include <textstream.h>
Public Member Functions | |
TextStream (unsigned from_col, unsigned to_col, unsigned from_row, unsigned to_row, bool use_cursor=false) | |
Constructor of a text window. More... | |
void | flush () override |
Output the buffer contents of the base class Stringbuffer. More... | |
![]() | |
OutputStream () | |
Default constructor. Initial number system is decimal. More... | |
virtual | ~OutputStream () |
Destructor. | |
virtual void | flush ()=0 |
Clears the buffer. More... | |
OutputStream & | operator<< (char c) |
Print a single character. More... | |
OutputStream & | operator<< (unsigned char c) |
Print a single character. More... | |
OutputStream & | operator<< (const char *string) |
Printing a null-terminated string. More... | |
OutputStream & | operator<< (bool b) |
Print a boolean value. More... | |
OutputStream & | operator<< (short ival) |
Print an integral number in radix base. More... | |
OutputStream & | operator<< (unsigned short ival) |
Print an integral number in radix base. More... | |
OutputStream & | operator<< (int ival) |
Print an integral number in radix base. More... | |
OutputStream & | operator<< (unsigned int ival) |
Print an integral number in radix base. More... | |
OutputStream & | operator<< (long ival) |
Print an integral number in radix base. More... | |
OutputStream & | operator<< (unsigned long ival) |
Print an integral number in radix base. More... | |
OutputStream & | operator<< (long long ival) |
Print an integral number in radix base. More... | |
OutputStream & | operator<< (unsigned long long ival) |
Print an integral number in radix base. More... | |
OutputStream & | operator<< (const void *ptr) |
Print a pointer as hexadecimal number. More... | |
OutputStream & | operator<< (OutputStream &(*f)(OutputStream &)) |
Calls one of the manipulator functions. More... | |
![]() | |
virtual | ~Stringbuffer () |
Destructor (nothing to do here) | |
![]() | |
TextWindow (unsigned from_col, unsigned to_col, unsigned from_row, unsigned to_row, bool use_cursor=false) | |
Constructor of a text window. More... | |
void | setPos (unsigned rel_x, unsigned rel_y) |
Set the cursor position in the window. More... | |
void | getPos (unsigned &rel_x, unsigned &rel_y) const |
Get the current cursor position in the window. More... | |
void | print (const char *string, size_t length, Attribute attrib=TextMode::Attribute()) |
Display multiple characters in the window. More... | |
void | reset (char character=' ', Attribute attrib=TextMode::Attribute()) |
Delete all contents in the window and reset the cursor. More... | |
Additional Inherited Members | |
![]() | |
enum | Color { BLACK , BLUE , GREEN , CYAN , RED , MAGENTA , BROWN , LIGHT_GREY , DARK_GREY , LIGHT_BLUE , LIGHT_GREEN , LIGHT_CYAN , LIGHT_RED , LIGHT_MAGENTA , YELLOW , WHITE } |
CGA color palette. More... | |
![]() | |
static void | setCursor (unsigned abs_x, unsigned abs_y) |
Set the keyboard hardware cursor to absolute screen position. More... | |
static void | getCursor (unsigned &abs_x, unsigned &abs_y) |
Retrieve the keyboard hardware cursor position on screen. More... | |
static void | show (unsigned abs_x, unsigned abs_y, char character, Attribute attrib=Attribute()) |
Basic output of a character at a specific position on the screen. More... | |
![]() | |
int | base |
Number system used for printing integral numbers (one of 2, 8, 10, or 16) | |
![]() | |
static const unsigned | ROWS = 25 |
Visible rows in text mode. | |
static const unsigned | COLUMNS = 80 |
Visible columns in text mode. | |
![]() | |
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... | |
![]() | |
TextMode () | |
Default constructor. | |
![]() | |
char | buffer [80+1] |
long unsigned | pos |
current position in the buffer | |
![]() | |
unsigned | from_col |
Start column position (inclusive) of window. | |
unsigned | to_col |
End column position (exclusive) of window. | |
unsigned | from_row |
Start row position (inclusive) of window. | |
unsigned | to_row |
End row position (exclusive) of window. | |
bool | use_cursor |
use hardware cursor More... | |
unsigned | pos_x |
Software cursor column. | |
unsigned | pos_y |
Software cursor row. | |
![]() | |
static Cell *const | TEXT_BUFFER_BASE = reinterpret_cast<TextMode::Cell *>(0xb8000) |
Base address for linear text buffer in video memory. | |
Output text (form different data type sources) on screen in text mode.
Allows the output of different data types as strings on the TextMode screen of a PC. To achieve this, TextStream is derived from both OutputStream and TextWindow and only implements the method TextStream::flush(). Further formatting or special effects are implemented in TextWindow.
|
inline |
Constructor of a text window.
Creates a virtual, rectangular text window on the screen. The coordinates to construct the window are absolute positions in the TextMode screen.
from_col | Text Window starts in column from_col , the first (leftmost) possible column is 0 |
to_col | Text Window extends to the right to column to_col (exclusive). This column has to be strictly greater than from_col , the maximum allowed value is TextMode::COLUMNS (rightmost) |
from_row | Text Window starts in row from_row , the first possible (uppermost) row is 0 |
to_row | Text Window extends down to row to_row (exclusive). This row has to be strictly greater than from_row , the maximum allowed value is TextMode::ROWS (bottom-most) |
use_cursor | Specifies whether the hardware cursor (true ) or a software cursor/variable (false ) should be used to store the current position |
|
overridevirtual |
Output the buffer contents of the base class Stringbuffer.
The method is automatically called when the buffer is full, but can also be called explicitly to force output of the current buffer.
Implements OutputStream.