fiber
Loading...
Searching...
No Matches
fiber::FormatInt< Int > Struct Template Reference

Formats an unsigned integer (of any size) for use with OStream. More...

#include <OStream.hpp>

Inheritance diagram for fiber::FormatInt< Int >:
fiber::FormatIntParams fiber::FormatStrParams fiber::_FormatUIntParams

Public Types

using value_type = typename fiber::make_fast<Int>::type
 

Public Member Functions

constexpr FormatInt ()=default
 
constexpr FormatInt (const FormatInt &)=default
 
constexpr FormatIntoperator= (const FormatInt &)=default
 
constexpr FormatInt (Int value)
 
constexpr FormatIntuse_thousands (bool b=true)
 enables thousand characters
 
constexpr FormatIntthousands (char c=',')
 enables thousand characters
 
constexpr FormatIntfsign (bool b=true)
 force the printing of the sign, even if it is positive.
 
constexpr FormatIntmwidth (int mw)
 
constexpr FormatIntfill (char c)
 
constexpr FormatIntpad_sign (bool b=true)
 
constexpr FormatIntleft ()
 
constexpr FormatIntright ()
 
constexpr FormatIntcenter ()
 
- Public Member Functions inherited from fiber::FormatIntParams
constexpr FormatIntParams ()=default
 
constexpr FormatIntParams (const FormatIntParams &)=default
 
constexpr FormatIntParamsoperator= (const FormatIntParams &)=default
 
constexpr FormatIntParams (const FormatStrParams &params)
 
constexpr FormatIntParamsoperator= (const FormatStrParams &params)
 

Static Public Member Functions

static constexpr FormatInt like (value_type value, const FormatIntParams &params)
 
template<std::integral Int1>
static constexpr FormatInt like (Int1 value, const FormatStrParams &params)
 

Public Attributes

value_type _value = 0
 
- Public Attributes inherited from fiber::FormatIntParams
bool _force_sign = false
 
bool _pad_sign = false
 
- Public Attributes inherited from fiber::FormatStrParams
AlignmentLRC _alignment = AlignmentLRC::Right
 
int _mwidth = 0
 
char _fill = ' '
 
- Public Attributes inherited from fiber::_FormatUIntParams
char _thousands_char = ','
 
bool _use_thousands = false
 

Detailed Description

template<std::integral Int>
struct fiber::FormatInt< Int >

Formats an unsigned integer (of any size) for use with OStream.

Member Typedef Documentation

◆ value_type

template<std::integral Int>
using fiber::FormatInt< Int >::value_type = typename fiber::make_fast<Int>::type

Constructor & Destructor Documentation

◆ FormatInt() [1/3]

template<std::integral Int>
fiber::FormatInt< Int >::FormatInt ( )
constexprdefault

◆ FormatInt() [2/3]

template<std::integral Int>
fiber::FormatInt< Int >::FormatInt ( const FormatInt< Int > & )
constexprdefault

◆ FormatInt() [3/3]

template<std::integral Int>
fiber::FormatInt< Int >::FormatInt ( Int value)
inlineconstexpr

Member Function Documentation

◆ center()

template<std::integral Int>
FormatInt & fiber::FormatInt< Int >::center ( )
inlineconstexpr

◆ fill()

template<std::integral Int>
FormatInt & fiber::FormatInt< Int >::fill ( char c)
inlineconstexpr

◆ fsign()

template<std::integral Int>
FormatInt & fiber::FormatInt< Int >::fsign ( bool b = true)
inlineconstexpr

force the printing of the sign, even if it is positive.

◆ left()

template<std::integral Int>
FormatInt & fiber::FormatInt< Int >::left ( )
inlineconstexpr

◆ like() [1/2]

template<std::integral Int>
template<std::integral Int1>
static constexpr FormatInt fiber::FormatInt< Int >::like ( Int1 value,
const FormatStrParams & params )
inlinestaticconstexpr

◆ like() [2/2]

template<std::integral Int>
static constexpr FormatInt fiber::FormatInt< Int >::like ( value_type value,
const FormatIntParams & params )
inlinestaticconstexpr

◆ mwidth()

template<std::integral Int>
FormatInt & fiber::FormatInt< Int >::mwidth ( int mw)
inlineconstexpr

◆ operator=()

template<std::integral Int>
FormatInt & fiber::FormatInt< Int >::operator= ( const FormatInt< Int > & )
constexprdefault

◆ pad_sign()

template<std::integral Int>
FormatInt & fiber::FormatInt< Int >::pad_sign ( bool b = true)
inlineconstexpr

◆ right()

template<std::integral Int>
FormatInt & fiber::FormatInt< Int >::right ( )
inlineconstexpr

◆ thousands()

template<std::integral Int>
FormatInt & fiber::FormatInt< Int >::thousands ( char c = ',')
inlineconstexpr

enables thousand characters

Example:

stream << FormatInt(4203).thousands('.'); //Outputs 4.203
stream << FormatInt(4203).thousands(','); //Outputs 4,203
constexpr FormatInt()=default

◆ use_thousands()

template<std::integral Int>
FormatInt & fiber::FormatInt< Int >::use_thousands ( bool b = true)
inlineconstexpr

enables thousand characters

Example:

stream << FormatInt(4203).use_thousands(); //Outputs 4,203
stream << FormatInt(4203).use_thousands(true); //Outputs 4,203
stream << FormatInt(4203).use_thousands(false); //Outputs 4203

Member Data Documentation

◆ _value

template<std::integral Int>
value_type fiber::FormatInt< Int >::_value = 0

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