This class uses n_lines
lines of stream_out
to show the output.
More...
#include <utilities.h>
Public Member Functions | |
OverWriteStream (unsigned int n_lines=1, Stream &stream_out=std::cout, unsigned int width=60) | |
~OverWriteStream () | |
Flush output at the end so that we don't make a mess with the console. More... | |
template<typename OBJ > | |
OverWriteStream< Stream > & | operator<< (OBJ &o) |
OverWriteStream< Stream > & | operator<< (std::ostream &(*p)(std::ostream &)) |
Stream & | get_stream () |
void | end () |
Move the cursor at the end of the output. More... | |
void | clear (bool force=false) |
Clear the next n lines, return back to the original point, and reset the clear flag if force is set to true, otherwise do this only if the internal counter is set to zero, i.e., we are at the beginning of the next n lines. More... | |
unsigned int | get_shell_rows () |
It returns the number of rows of the current shell. More... | |
unsigned int | get_shell_cols () |
It returns the number of coloumns of the current shell. More... | |
int | get_current_line () |
It returns current line of the stream. More... | |
Private Attributes | |
unsigned int | cols_shell |
unsigned int | rows_shell |
const unsigned int | n_lines |
const unsigned int | width |
bool | clear_next |
unsigned int | current_line |
Stream & | stream_out |
Friends | |
template<typename S , typename T > | |
OverWriteStream< S > & | operator<< (OverWriteStream< S > &, const T &) |
This class uses n_lines
lines of stream_out
to show the output.
Everytime it reaches the last line it comes back to the first line and rewrites the line.
The constructor takes as argument a stream for the output stream_out
(default = std::cout), the number of lines n_lines
, and the width of the output.
Definition at line 185 of file utilities.h.
|
inline |
Definition at line 200 of file utilities.h.
|
inline |
Flush output at the end so that we don't make a mess with the console.
Definition at line 221 of file utilities.h.
|
inline |
Clear the next n lines, return back to the original point, and reset the clear flag if force is set to true, otherwise do this only if the internal counter is set to zero, i.e., we are at the beginning of the next n lines.
Definition at line 320 of file utilities.h.
|
inline |
Move the cursor at the end of the output.
It is needed to avoid to rewrite useful lines. Finally, this method delete the class.
Definition at line 305 of file utilities.h.
|
inline |
It returns current line of the stream.
Definition at line 374 of file utilities.h.
|
inline |
It returns the number of coloumns of the current shell.
Definition at line 366 of file utilities.h.
|
inline |
It returns the number of rows of the current shell.
Definition at line 358 of file utilities.h.
|
inline |
Definition at line 295 of file utilities.h.
|
inline |
Definition at line 228 of file utilities.h.
|
inline |
Definition at line 235 of file utilities.h.
|
friend |
Definition at line 395 of file utilities.h.
|
private |
Definition at line 385 of file utilities.h.
|
private |
Definition at line 380 of file utilities.h.
|
private |
Definition at line 387 of file utilities.h.
|
private |
Definition at line 383 of file utilities.h.
|
private |
Definition at line 381 of file utilities.h.
|
private |
Definition at line 389 of file utilities.h.
|
private |
Definition at line 384 of file utilities.h.