CFixedWidthOutput Class Reference

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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ CFixedWidthOutput()

CFixedWidthOutput::CFixedWidthOutput ( std::ostream &  os,
size_t  width 
)

Construct the class

Parameters
osthe output stream to write to
widththe maximal width of an output line

Member Function Documentation

◆ newline()

void CFixedWidthOutput::newline ( )

Force a line break.

◆ pop_offset()

void CFixedWidthOutput::pop_offset ( )

restore the last offset

◆ push_offset()

void CFixedWidthOutput::push_offset ( size_t  offset)

Set a new offset from the left margin, the original offset is stored in a stack,

Parameters
offset

◆ reset_offset()

void CFixedWidthOutput::reset_offset ( )

Reset the offset to zero and clear the offset stack.

◆ set_linecontinue()

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)

Parameters
value

◆ write()

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.

Parameters
text

The documentation for this class was generated from the following file: