Steppable 0.0.1
A CAS project written from scratch in C++
Loading...
Searching...
No Matches
steppable::prettyPrint::ConsoleOutput Class Reference

Represents a console output buffer. More...

#include <symbols.hpp>

Collaboration diagram for steppable::prettyPrint::ConsoleOutput:
[legend]

Public Member Functions

 ConsoleOutput (size_t height, size_t width)
 Creates a new console output buffer.
 
void write (char c, long long dLine, long long dCol, bool updatePos=false)
 Writes a character to the buffer.
 
void write (char c, const Position &pos, bool updatePos=false)
 Writes a character to the buffer.
 
void write (const std::string &s, const Position &pos, bool updatePos=false)
 Writes a string to the buffer.
 
std::string asString () const
 Gets the buffer as a string.
 

Private Attributes

Position curPos
 The current position.
 
std::vector< std::vector< char > > buffer
 The buffer object.
 
size_t height = 10
 The height of the buffer.
 
size_t width = 10
 The width of the buffer.
 

Detailed Description

Represents a console output buffer.

Constructor & Destructor Documentation

◆ ConsoleOutput()

steppable::prettyPrint::ConsoleOutput::ConsoleOutput ( size_t height,
size_t width )

Creates a new console output buffer.

Parameters
heightThe height of the buffer.
widthThe width of the buffer.

Member Function Documentation

◆ asString()

std::string steppable::prettyPrint::ConsoleOutput::asString ( ) const
nodiscard

Gets the buffer as a string.

Returns
The buffer as a string.

◆ write() [1/3]

void steppable::prettyPrint::ConsoleOutput::write ( char c,
const Position & pos,
bool updatePos = false )

Writes a character to the buffer.

Parameters
cThe character to write.
posThe position to write to.
updatePosWhether to update the current position.

◆ write() [2/3]

void steppable::prettyPrint::ConsoleOutput::write ( char c,
long long dLine,
long long dCol,
bool updatePos = false )

Writes a character to the buffer.

Parameters
cThe character to write.
dLineThe change in line.
dColThe change in column.
updatePosWhether to update the current position.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write() [3/3]

void steppable::prettyPrint::ConsoleOutput::write ( const std::string & s,
const Position & pos,
bool updatePos = false )

Writes a string to the buffer.

Parameters
sThe string to write.
posThe position to write to.
updatePosWhether to update the current position.
Here is the call graph for this function:

Member Data Documentation

◆ buffer

std::vector<std::vector<char> > steppable::prettyPrint::ConsoleOutput::buffer
private

The buffer object.

◆ curPos

Position steppable::prettyPrint::ConsoleOutput::curPos
private

The current position.

◆ height

size_t steppable::prettyPrint::ConsoleOutput::height = 10
private

The height of the buffer.

◆ width

size_t steppable::prettyPrint::ConsoleOutput::width = 10
private

The width of the buffer.


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