Joutsen  v0.4.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Joutsen.System.ConsoleProgressBarPainter Class Reference

A class that can be used to write a progress value and a progressbar to the console. More...

Public Member Functions

 ConsoleProgressBarPainter (int progressBarWidth, String format="{Description} {ProgressTotal} {ProgressBar} {ProgressPercentage}")
 Creates a new instance of the painter with a defined width for the progress bar. More...
 
 ConsoleProgressBarPainter (int progressBarWidth, int descriptionWidth, String format="{Description} {ProgressTotal} {ProgressBar} {ProgressPercentage}", ushort maxWritesPerSecond=5)
 Creates a new instance of the painter with a defined width for the progress bar and description. More...
 
 ConsoleProgressBarPainter (String format="{Description} {ProgressTotal} {ProgressBar} {ProgressPercentage}")
 Creates a new instance of the painter with a defined format. More...
 
- Public Member Functions inherited from Joutsen.System.ConsoleProgressPainter
 ConsoleProgressPainter (ushort maxWritesPerSecond=5)
 Creates a new instance with a certain maximum of console updates a second. More...
 
virtual void ProgressUpdate (double completed, double total, double progress)
 Writes the updated progress to the console. More...
 
virtual void DescriptionUpdate (String description)
 Writes the updated description to the console. More...
 
void Paint ()
 Updates the console output. More...
 
virtual void Clear ()
 Resets the painter in order to restart updates to the console. More...
 

Protected Member Functions

override void Paint (double completed, double total, double progress, string description)
 In a derived class handles the actual writing to the console. More...
 

Protected Attributes

int descriptionWidth
 The width in number of characters that the description text is allowed to use. More...
 
int progressBarWidth
 The width in number of characters that the progress bar is allowed to use. More...
 
int progressTotalWidth
 
String format
 The format of the output. More...
 
String layout
 
- Protected Attributes inherited from Joutsen.System.ConsoleProgressPainter
String description
 The description to write. More...
 
double progress
 The progress value to write. More...
 
double completed
 
double total
 

Detailed Description

A class that can be used to write a progress value and a progressbar to the console.

Since
0.4.1

Constructor & Destructor Documentation

◆ ConsoleProgressBarPainter() [1/3]

Joutsen.System.ConsoleProgressBarPainter.ConsoleProgressBarPainter ( int  progressBarWidth,
String  format = "{Description}  {ProgressTotal} {ProgressBar} {ProgressPercentage}" 
)

Creates a new instance of the painter with a defined width for the progress bar.

Parameters
progressBarWidththe width in characters that the progress bar is allowed to use
formata format string defining the output
Remarks
The format can containe the three following elements {Description}, {ProgressBar} and {ProgressPercentage} to define if and where they are displayed. The actual output will also respect the defined size of the progressbar and will adjust the size of the description accordingly.

◆ ConsoleProgressBarPainter() [2/3]

Joutsen.System.ConsoleProgressBarPainter.ConsoleProgressBarPainter ( int  progressBarWidth,
int  descriptionWidth,
String  format = "{Description}  {ProgressTotal} {ProgressBar} {ProgressPercentage}",
ushort  maxWritesPerSecond = 5 
)

Creates a new instance of the painter with a defined width for the progress bar and description.

Parameters
progressBarWidththe width in characters that the progress bar is allowed to use
descriptionWidththe width in characters that the description is allowed to use
formata format string defining the output
maxWritesPerSecondthe maximum number of writes to the console per second, default is 5
Remarks
The format can containe the three following elements {Description}, {ProgressBar} and {ProgressPercentage} to define if and where they are displayed. The actual output will also respect the defined size of the progressbar and description.

◆ ConsoleProgressBarPainter() [3/3]

Joutsen.System.ConsoleProgressBarPainter.ConsoleProgressBarPainter ( String  format = "{Description}  {ProgressTotal} {ProgressBar} {ProgressPercentage}")

Creates a new instance of the painter with a defined format.

Parameters
formata format string defining the output
Remarks
The format can containe the three following elements {Description}, {ProgressBar} and {ProgressPercentage} to define if and where they are displayed. The actual output will try to adjust the description and progress bar to fit into one line.

Member Function Documentation

◆ Paint()

override void Joutsen.System.ConsoleProgressBarPainter.Paint ( double  completed,
double  total,
double  progress,
string  description 
)
protectedvirtual

In a derived class handles the actual writing to the console.

Implements Joutsen.System.ConsoleProgressPainter.

Member Data Documentation

◆ descriptionWidth

int Joutsen.System.ConsoleProgressBarPainter.descriptionWidth
protected

The width in number of characters that the description text is allowed to use.

◆ format

String Joutsen.System.ConsoleProgressBarPainter.format
protected

The format of the output.

◆ layout

String Joutsen.System.ConsoleProgressBarPainter.layout
protected

◆ progressBarWidth

int Joutsen.System.ConsoleProgressBarPainter.progressBarWidth
protected

The width in number of characters that the progress bar is allowed to use.

◆ progressTotalWidth

int Joutsen.System.ConsoleProgressBarPainter.progressTotalWidth
protected