Classes |
|
class | senf::format::IndentHelper |
Helper class to easily achieve indent levels. More... |
|
Functions |
|
streamable_type | senf::format::eng (float v, float d=NAN) |
Format value in engineering representation. |
|
template<class T > | |
streamable_type | senf::format::dumpint (T const &v) |
Dump integer value with internal representation. |
streamable_type senf::format:: | ||||
dumpint | ( | T const & | v | ) |
Dump integer value with internal representation.
senf::format::dumpint() will output a signed or unsigned numeric argument in the following representations:
senf::format::eng:: | ||||
eng | ( | float | v, | |
float |
d = NAN
|
) | ||
Format value in engineering representation.
The engineering representation is an exponential representation. Exponents however are always multiples of 3:
123.45 -> 123.450e+00 123.45e2 -> 12.345e+03
Additionally, an optional delta value may be displayed:
123.45+-1.34e+03
senf::format::eng supports several formating options:
std
::setw
ajustfield
setting (changed with std::left
, std:
;right or std::interal
). If the adjustfield
is set to internal
, padding is added between the sign and the number.std
::setprecision
std
::showbase
, std
::noshowbase
showbase
flag is set, Instead of writing out the scale exponent in numeric form, output the corresponding SI prefix.std
::showpos
, std
::noshowpos
showpos
flag is set, positive values will have a '+' sign.std
::showpoint
, std
::noshowpoint
showpoint
flag is set, the exponent will be output even if it is 0. Otherwise, if width
is set, the exponent will be replaced with 4 blanks.std
::uppercase
, std
::nouppercase
uppercase
flag is set, the exponent letter will be an uppercase 'E' instead of 'e'. SI prefixes are not uppercased, since some SI prefixes differ only in case.std
::setfill
std
::left
, std
::internal
, std
::right
Examples:
os << senf::format::eng(1.23); -> "1.230" os << std::setw(1) << senf::format::eng(1.23); -> " 1.230 " os << std::setw(25) << std::setprecision(5) << std::showpos << std::uppercase << std::internal << senf::format::eng(12345,67); -> "+ 12.35+-000.07E+03" os << std::showbase << senf::format::eng(12345,67); -> "12.345+-0.067k" senf::str(senf::format::eng(12.345,67).setw().setprecision(5).showpoint().uppercase()) -> " 12.35+-67.00E+00"
[in] | v | value |
[in] | d | optional delta |
Definition at line 36 of file Format.cci.