Steppable 0.0.1
A CAS project written from scratch in C++
|
Represents a console output buffer. More...
#include <symbols.hpp>
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, const ColorFunc &color=colors::keepOriginal, const HorizontalAlignment &alignment=HorizontalAlignment::LEFT) |
Writes a character to the buffer. | |
void | write (char c, const Position &pos, bool updatePos=false, const ColorFunc &color=colors::keepOriginal, const HorizontalAlignment &alignment=HorizontalAlignment::LEFT) |
Writes a character to the buffer. | |
void | write (const std::string_view &s, const Position &pos, bool updatePos=false, const ColorFunc &color=colors::keepOriginal, const HorizontalAlignment &alignment=HorizontalAlignment::LEFT) |
Writes a string_view object to the buffer. | |
std::string | asString () const |
Gets the buffer as a string. |
Private Member Functions | |
void | _write (const std::string &s, const Position &pos, bool updatePos=false, const ColorFunc &color=colors::keepOriginal, const HorizontalAlignment &alignment=HorizontalAlignment::LEFT) |
Writes a string to the buffer. |
Private Attributes | |
Position | curPos |
The current position. | |
std::vector< std::vector< std::string > > | buffer |
The buffer object. | |
size_t | height = 10 |
The height of the buffer. | |
size_t | width = 10 |
The width of the buffer. |
Represents a console output buffer.
steppable::prettyPrint::ConsoleOutput::ConsoleOutput | ( | size_t | height, |
size_t | width ) |
Creates a new console output buffer.
height | The height of the buffer. |
width | The width of the buffer. |
|
private |
Writes a string to the buffer.
s | The string to write. |
pos | The position to write to. |
updatePos | Whether to update the current position. |
color | Color of the text to write. |
|
nodiscard |
Gets the buffer as a string.
void steppable::prettyPrint::ConsoleOutput::write | ( | char | c, |
const Position & | pos, | ||
bool | updatePos = false, | ||
const ColorFunc & | color = colors::keepOriginal, | ||
const HorizontalAlignment & | alignment = HorizontalAlignment::LEFT ) |
Writes a character to the buffer.
c | The character to write. |
pos | The position to write to. |
updatePos | Whether to update the current position. |
color | Color of the text to write. |
void steppable::prettyPrint::ConsoleOutput::write | ( | char | c, |
long long | dLine, | ||
long long | dCol, | ||
bool | updatePos = false, | ||
const ColorFunc & | color = colors::keepOriginal, | ||
const HorizontalAlignment & | alignment = HorizontalAlignment::LEFT ) |
Writes a character to the buffer.
c | The character to write. |
dLine | The change in line. |
dCol | The change in column. |
updatePos | Whether to update the current position. |
color | Color of the text to write. |
|
inline |
Writes a string_view object to the buffer.
s | The string to write. |
pos | The position to write to. |
updatePos | Whether to update the current position. |
color | Color of the text to write. |
|
private |
The buffer object.
|
private |
The current position.
|
private |
The height of the buffer.
|
private |
The width of the buffer.