Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::Formatter Class Reference

Class implements a formater like QString from Qt. More...

#include <Formatter.h>

Public Member Functions

 Formatter (const std::string &fmt)
 Constructor takes a const reference to a std::string.
 
 Formatter (const Formatter &other)
 Copy constructor.
 
 Formatter (Formatter &&other) noexcept
 Move constructor.
 
Formatteroperator= (const Formatter &other)
 Assignment operator.
 
Formatteroperator= (Formatter &&other) noexcept
 Move assignment operator.
 
Formatterarg (const std::string &arg, int width=0)
 Argument to string formatter.
 
Formatterarg (const char *arg, int width=0)
 Argument to string formatter.
 
Formatterarg (int arg, int width=0)
 Argument to string formatter.
 
Formatterarg (unsigned int arg, int width=0)
 Argument to string formatter.
 
Formatterarg (long arg, int width=0)
 Argument to string formatter.
 
Formatterarg (unsigned long arg, int width=0)
 Argument to string formatter.
 
Formatterarg (long long arg, int width=0)
 Argument to string formatter.
 
Formatterarg (unsigned long long arg, int width=0)
 Argument to string formatter.
 
Formatterarg (float arg, int width=0, int precision=std::numeric_limits< int >::max())
 Argument to string formatter.
 
Formatterarg (double arg, int width=0, int precision=std::numeric_limits< int >::max())
 Argument to string formatter.
 
std::string str () const
 Gets the assembled std::string class.
 
 operator std::string () const
 Operator calling str() method.
 

Detailed Description

Class implements a formater like QString from Qt.

sf::Formatter("Align left [%1]").arg("abc", 6).str() // Results in "Align left [abc ]"
// Example having escaped '%' character.
sf::Formatter("Align argument '%%1' right [%1]").arg(123, 6).str() // Results in "Align argument '%1' right [ 123]"
Class implements a formater like QString from Qt.
Definition Formatter.h:19
Formatter & arg(const std::string &arg, int width=0)
Argument to string formatter.
std::string str() const
Gets the assembled std::string class.

Constructor & Destructor Documentation

◆ Formatter() [1/3]

sf::Formatter::Formatter ( const std::string &  fmt)
explicit

Constructor takes a const reference to a std::string.

Parameters
fmtFormat string.

◆ Formatter() [2/3]

sf::Formatter::Formatter ( const Formatter other)

Copy constructor.

Parameters
other

◆ Formatter() [3/3]

sf::Formatter::Formatter ( Formatter &&  other)
noexcept

Move constructor.

Member Function Documentation

◆ arg() [1/10]

Formatter & sf::Formatter::arg ( const char *  arg,
int  width = 0 
)

Argument to string formatter.

Parameters
argString value.
widthLeft align to this width.
Returns
Itself.

◆ arg() [2/10]

Formatter & sf::Formatter::arg ( const std::string &  arg,
int  width = 0 
)

Argument to string formatter.

Parameters
argString value.
widthLeft align to this width.
Returns
Itself.

◆ arg() [3/10]

Formatter & sf::Formatter::arg ( double  arg,
int  width = 0,
int  precision = std::numeric_limits< int >::max() 
)

Argument to string formatter.

Parameters
argDouble value.
widthRight align to this width.
precisionSee toStringPrecision()
Returns
Itself.

◆ arg() [4/10]

Formatter & sf::Formatter::arg ( float  arg,
int  width = 0,
int  precision = std::numeric_limits< int >::max() 
)

Argument to string formatter.

Parameters
argFloat value.
widthRight align to this width.
precisionSee toStringPrecision()
Returns
Itself.

◆ arg() [5/10]

Formatter & sf::Formatter::arg ( int  arg,
int  width = 0 
)

Argument to string formatter.

Parameters
argInteger value.
widthRight align to this width.
Returns
Itself.

◆ arg() [6/10]

Formatter & sf::Formatter::arg ( long  arg,
int  width = 0 
)

Argument to string formatter.

Parameters
argInteger value.
widthRight align to this width.
Returns
Itself.

◆ arg() [7/10]

Formatter & sf::Formatter::arg ( long long  arg,
int  width = 0 
)

Argument to string formatter.

Parameters
argInteger value.
widthRight align to this width.
Returns
Itself.

◆ arg() [8/10]

Formatter & sf::Formatter::arg ( unsigned int  arg,
int  width = 0 
)

Argument to string formatter.

Parameters
argInteger value.
widthRight align to this width.
Returns
Itself.

◆ arg() [9/10]

Formatter & sf::Formatter::arg ( unsigned long  arg,
int  width = 0 
)

Argument to string formatter.

Parameters
argInteger value.
widthRight align to this width.
Returns
Itself.

◆ arg() [10/10]

Formatter & sf::Formatter::arg ( unsigned long long  arg,
int  width = 0 
)

Argument to string formatter.

Parameters
argInteger value.
widthRight align to this width.
Returns
Itself.

◆ operator std::string()

sf::Formatter::operator std::string ( ) const

Operator calling str() method.

◆ operator=() [1/2]

Formatter & sf::Formatter::operator= ( const Formatter other)

Assignment operator.

◆ operator=() [2/2]

Formatter & sf::Formatter::operator= ( Formatter &&  other)
noexcept

Move assignment operator.

◆ str()

std::string sf::Formatter::str ( ) const

Gets the assembled std::string class.


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