Timer Console
Loading...
Searching...
No Matches
Write Class Reference

Write class creates an abstraction for controlling how the terminal will print to the screen. More...

#include <write.h>

Collaboration diagram for Write:

Classes

struct  TerminalSize
 Terminal size structure defines a simple interface for defining a width and a height integer. More...
 

Public Types

enum  Colors {
  YELLOW = 0 , RED = 1 , BLUE =2 , BLACK = 3 ,
  PURPLE =4 , CYAN = 5 , WHITE = 6 , ENDCOLOR = 7
}
 Colors integer enum creates an easy interface for defining colors to use in the console when printing. More...
 

Public Member Functions

 Write ()
 

Static Public Member Functions

static std::string c (const Colors &color)
 c method returns a color associated with enum
 
static void clearSection (int x, int y, int width, int height)
 clearSection erases specified section of the terminal by replacing them with empty strings
 
static void printInSection (int x, int y, std::string text)
 printInSection takes a section of the terminal and prints the specified string in the section
 
static void clearAllConsole ()
 clearAllConsole method clears the entire console erasing all characters on the console screen
 

Static Public Attributes

static TerminalSize myTerminalSize
 myTerminalSize is a public variable to use throughout the application to easily query the terminal dimensions the user is currently working with
 

Detailed Description

Write class creates an abstraction for controlling how the terminal will print to the screen.

Member Enumeration Documentation

◆ Colors

Colors integer enum creates an easy interface for defining colors to use in the console when printing.

Enumerator
YELLOW 
RED 
BLUE 
BLACK 
PURPLE 
CYAN 
WHITE 
ENDCOLOR 

Constructor & Destructor Documentation

◆ Write()

Write::Write ( )

Member Function Documentation

◆ c()

std::string Write::c ( const Colors & color)
static

c method returns a color associated with enum

See also
Colors
Parameters
colorENUM color
See also
Colors

◆ clearAllConsole()

void Write::clearAllConsole ( )
static

clearAllConsole method clears the entire console erasing all characters on the console screen

◆ clearSection()

void Write::clearSection ( int x,
int y,
int width,
int height )
static

clearSection erases specified section of the terminal by replacing them with empty strings

Parameters
xInteger indicating where to start the cursor in column
yInteger indicating where to start the cursor in row
widthInteger indicating the amount of columns the cursor should travel to erase
heightInteger indicating the amount of rows the cursor should travel to erase

◆ printInSection()

void Write::printInSection ( int x,
int y,
std::string text )
static

printInSection takes a section of the terminal and prints the specified string in the section

Parameters
xInteger indicating where to start the cursor in column
yInteger indicating where to start the cursor in row
textString that should be printed

Member Data Documentation

◆ myTerminalSize

Write::TerminalSize Write::myTerminalSize
static
Initial value:
= {
0,
0
}

myTerminalSize is a public variable to use throughout the application to easily query the terminal dimensions the user is currently working with


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