Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TTerminal Class Reference

Implements a "dumb" terminal with buffered string reads and writes. More...

#include <textview.h>

Inheritance diagram for TTerminal::

TTextDevice TScroller TView TObject TStreamable List of all members.

Public Methods

 TTerminal (const TRect &bounds, TScrollBar *aHScrollBar, TScrollBar *aVScrollBar, ushort aBufSize)
 ~TTerminal ()
virtual int do_sputn (const char *s, int count)
void bufInc (ushort &val)
Boolean canInsert (ushort amount)
short calcWidth ()
virtual void draw ()
ushort nextLine (ushort pos)
ushort prevLines (ushort pos, ushort lines)
Boolean queEmpty ()

Protected Methods

void bufDec (ushort &val)

Protected Attributes

ushort bufSize
char* buffer
ushort queFront
ushort queBack
ushort curLineWidth

Detailed Description

TTerminal implements a "dumb" terminal with buffered string reads and writes. The default is a cyclic buffer of 64K bytes.

Definition at line 70 of file textview.h.


Constructor & Destructor Documentation

TTerminal::TTerminal ( const TRect & bounds,
TScrollBar * aHScrollBar,
TScrollBar * aVScrollBar,
ushort aBufSize )
 

Creates a TTerminal object with the given bounds, horizontal and vertical scroll bars, and buffer by calling TTextDevice constructor with the bounds and scroller arguments, then creating a buffer (pointed to by buffer) with bufSize equal to `aBufSize'.

See also:
TTextDevice::TTextDevice

growMode is set to gfGrowHiX | gfGrowHiY. queFront and queBack are both initialized to 0, indicating an empty buffer. The cursor is shown at the view's origin, (0,0).

TTerminal::~TTerminal ( )
 

Deallocates the buffer and calls ~TTextDevice().


Member Function Documentation

void TTerminal::bufDec ( ushort & val ) [protected]
 

Used to manipulate queue offsets with wrap around: if `val' is zero, `val' is set to (bufSize - 1); otherwise, `val' is decremented.

void TTerminal::bufInc ( ushort & val )
 

Used to manipulate a queue offsets with wrap around: increments `val' by 1, then if `val' >= bufSize, `val' is set to zero.

short TTerminal::calcWidth ( )
 

Undocumented.

Boolean TTerminal::canInsert ( ushort amount )
 

Returns True if the number of bytes given in amount can be inserted into the terminal buffer without having to discard the top line. Otherwise, returns False.

int TTerminal::do_sputn ( const char * s,
int count ) [virtual]
 

Overrides the corresponding function in class streambuf.

This is an internal function that is called whenever a character string is to be inserted into the internal buffer.

Reimplemented from TTextDevice.

void TTerminal::draw ( ) [virtual]
 

Called whenever the TTerminal scroller needs to be redrawn; for example, when the scroll bars are clicked on, the view is unhidden or resized, the delta values are changed, or when added text forces a scroll.

Reimplemented from TView.

ushort TTerminal::nextLine ( ushort pos )
 

Returns the buffer offset of the start of the line that follows the position given by `pos'.

ushort TTerminal::prevLines ( ushort pos,
ushort lines )
 

Returns the offset of the start of the line that is `lines' lines previous to the position given by `pos'.

Boolean TTerminal::queEmpty ( )
 

Returns True if queFront is equal to queBack.


Member Data Documentation

ushort TTerminal::bufSize [protected]
 

The size of the terminal's buffer in bytes.

Definition at line 140 of file textview.h.

char * TTerminal::buffer [protected]
 

Pointer to the first byte of the terminal's buffer.

Definition at line 144 of file textview.h.

ushort TTerminal::curLineWidth [protected]
 

Undocumented.

Definition at line 162 of file textview.h.

ushort TTerminal::queBack [protected]
 

Offset (in bytes) of the last byte stored in the terminal buffer.

Definition at line 152 of file textview.h.

ushort TTerminal::queFront [protected]
 

Offset (in bytes) of the first byte stored in the terminal buffer.

Definition at line 148 of file textview.h.


The documentation for this class was generated from the following file:
Generated at Sat Sep 22 20:19:37 2001 for TVision by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001