Tomographer  v4.0
Tomographer C++ Framework Documentation
Tomographer::Tools::ConsoleFormatterHelper Class Reference

Minimal tool for formatting console stuff with fixed line width. More...

#include <tomographer/tools/fmt.h>

Public Member Functions

 ConsoleFormatterHelper (int width=0)
 Constructor. More...
 
int columns () const
 The number of character columns (as specified to the constructor)
 
std::string centerLine (std::string x)
 Produce a centered string. More...
 
std::string rightLine (std::string x)
 Produce a right-aligned string. More...
 
std::string leftLine (std::string x)
 Produce a left-aligned string. More...
 
std::string hrule (char pattern='-')
 

Detailed Description

Minimal tool for formatting console stuff with fixed line width.

Definition at line 404 of file fmt.h.

Constructor & Destructor Documentation

§ ConsoleFormatterHelper()

Tomographer::Tools::ConsoleFormatterHelper::ConsoleFormatterHelper ( int  width = 0)
inline

Constructor.

Parameters
widthis the target with of the stuff you want to output. If width is zero, then an appropriate default is chosen including an attempt to detect the current console width.

Definition at line 414 of file fmt.h.

Member Function Documentation

§ centerLine()

std::string Tomographer::Tools::ConsoleFormatterHelper::centerLine ( std::string  x)
inline

Produce a centered string.

Returns
a string of columns() characters, with x displayed in the middle of the line. A newline is added. If x is wider than the line length, it is returned in full with a newline appended.

Definition at line 428 of file fmt.h.

§ leftLine()

std::string Tomographer::Tools::ConsoleFormatterHelper::leftLine ( std::string  x)
inline

Produce a left-aligned string.

Returns
a string of columns() characters, with x displayed at the left of the line. The string is padded with spaces and a final newline. If x is wider than the line length, it is returned in full with a newline appended.

Definition at line 460 of file fmt.h.

§ rightLine()

std::string Tomographer::Tools::ConsoleFormatterHelper::rightLine ( std::string  x)
inline

Produce a right-aligned string.

Returns
a string of columns() characters, with x displayed at the right of the line. A newline is added. If x is wider than the line length, it is returned in full with a newline appended.

Definition at line 445 of file fmt.h.


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