|
BDE 4.39.x Production Release
|
Provide an attribute class to configure decimal formatting.
Provide an attribute class to configure decimal formatting.
This component provides a single, simply constrained (value-semantic) attribute class, bdldfp::DecimalFormatConfig, that is used to configure various aspects of decimal value formatting.
| Name | Type | Default | Simple Constraints |
|---|---|---|---|
| style | Style | e_NATURAL | none |
| precision | int | 0 | >= -1 |
| sign | Sign | e_NEGATIVE_ONLY | none |
| infinity | string | "inf" | none |
| nan | string | "nan" | none |
| snan | string | "snan" | none |
| point | char | '.' | none |
| exponent | char | 'e' | none |
| showpoint | bool | false | none |
| expwidth | int | 2 | >= 1, <= 4 |
style: control how the decimal number is written. If style is e_SCIENTIFIC, the number is written as its sign, then a single digit, then the decimal point, then precision digits, then the exponent character, then a - or +, then an exponent with no leading zeroes (with a zero exponent written as 0). If style is e_FIXED, the number is written as its sign, then one or more digits, then the decimal point, then precision digits. If the precision value equals 0 then precision digits and the decimal point are not written. If style is e_NATURAL, the number is written according to the description of to-scientific-string found in http://speleotrove.com/decimal/decarith.pdf (and no other specified formatting values are used, except precision that has to be set to -1 to get the actual natural format with the natural precision).precision: control how many digits are written after the decimal point. When -1 is specified for precision, the number is written using its natural precision in every format, while specifying a zero or positive precision overrides said natural precision.sign: control how the sign is output. If a decimal value has its sign bit set, a - is always written. Otherwise, if sign is e_NEGATIVE_ONLY, no sign is written. If it is e_ALWAYS, a + is written. If it is e_POSITIVE_AS_SPACE a space character is written in case the value is positive, while a negative sign for negative values.infinity: specify a string to output infinity value.nan: specify a string to output NaN value.snan: specify a string to output signaling NaN value.point: specify the character to use for decimal points.exponent: specify the character to use for exponent when style is e_SCIENTIFIC or e_NATURAL.showpoint: specify whether a decimal point is always displayed.expwidth: control the minimum number of digits used to write the exponent.