Fishtank
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Screen Class Referenceabstract

Represents the abstract notion of a character-addressable writable screen. More...

#include <screen.h>

Inheritance diagram for Screen:
Inheritance graph
[legend]

Public Member Functions

 Screen (int width, int height)
 
int width () const
 
int height () const
 
virtual void charAtPut (int col, int row, char value)=0
 
virtual void clear ()=0
 

Protected Member Functions

void checkCoordinates (int col, int row) const
 

Protected Attributes

int width_
 
int height_
 

Detailed Description

Represents the abstract notion of a character-addressable writable screen.

Definition at line 4 of file screen.h.

Constructor & Destructor Documentation

◆ Screen()

Screen::Screen ( int  width,
int  height 
)
explicit
Parameters
widthwidth in columns
heightheight in rows
Exceptions
std::out_of_rangeif width or height is negative

Definition at line 5 of file screen.cpp.

Member Function Documentation

◆ charAtPut()

virtual void Screen::charAtPut ( int  col,
int  row,
char  value 
)
pure virtual

Abstract function that subclasses should override. May not cause the screen to update immediately.

Parameters
col0-based column (x) index
row0-based row (y) index
valuethe character to write
Exceptions
std::out_of_rangeif the row or column is out of bounds (negative or too large)

Implemented in StringScreen.

◆ checkCoordinates()

void Screen::checkCoordinates ( int  col,
int  row 
) const
protected

Definition at line 16 of file screen.cpp.

◆ clear()

virtual void Screen::clear ( )
pure virtual

Abstract function that subclasses should override. May not cause the screen to update immediately.

Implemented in StringScreen.

◆ height()

int Screen::height ( ) const
Returns
the height in rows

Definition at line 33 of file screen.cpp.

◆ width()

int Screen::width ( ) const
Returns
the width in columns

Definition at line 31 of file screen.cpp.

Member Data Documentation

◆ height_

int Screen::height_
protected

Definition at line 29 of file screen.h.

◆ width_

int Screen::width_
protected

Definition at line 28 of file screen.h.


The documentation for this class was generated from the following files: