This class provides formatted writing to a text console. More...
#include <mia/core/fixedwidthoutput.hh>
Public Member Functions | |
CFixedWidthOutput (std::ostream &os, size_t width) | |
void | newline () |
void | pop_offset () |
void | push_offset (size_t offset) |
void | reset_offset () |
void | set_linecontinue (bool value) |
void | write (const std::string &text) |
This class provides formatted writing to a text console.
This class is used to write output to a ostream and the text is formatted to not exeed the given width (e.g. the width of the text console stdout. The class is used to write out the formated help of CCmdOptionList.
Definition at line 39 of file fixedwidthoutput.hh.
CFixedWidthOutput::CFixedWidthOutput | ( | std::ostream & | os, |
size_t | width | ||
) |
Construct the class
os | the output stream to write to |
width | the maximal width of an output line |
void CFixedWidthOutput::newline | ( | ) |
Force a line break.
void CFixedWidthOutput::pop_offset | ( | ) |
restore the last offset
void CFixedWidthOutput::push_offset | ( | size_t | offset | ) |
Set a new offset from the left margin, the original offset is stored in a stack,
offset |
void CFixedWidthOutput::reset_offset | ( | ) |
Reset the offset to zero and clear the offset stack.
void CFixedWidthOutput::set_linecontinue | ( | bool | value | ) |
Set to true if newline() should insert '\' to indicate a continuing line (e.g. for writing code examples that don't fit on one line)
value |
void CFixedWidthOutput::write | ( | const std::string & | text | ) |
Write the text to the output. New line '\n' and tabulators '\t' are honoured. At a new-line the line start positionis set to the actual offset. If a word doesn't fit the current line, a line break is inserted automatically.
text |