This is the reference documentation module ALib Format.
Extensive documentation for this namespace is provided with the Programmer's Manual of that module.
Type Index: | |
| struct | ByteSizeIEC |
| struct | ByteSizeSI |
| struct | FFormat |
| struct | FMTCallerInfo |
| class | Formatter |
| class | FormatterJavaStyle |
| class | FormatterPythonStyle |
| class | FormatterStdImpl |
| class | Paragraphs |
| class | PropertyFormatter |
| struct | PropertyFormatterMapAppendable |
| class | PropertyFormatters |
Function Index: | |
| void | FFormat_CallerInfo (const Box &self, const String &formatSpec, NumberFormat &nf, AString &target) |
| void | FFormat_DateTime (const Box &self, const String &formatSpec, NumberFormat &nf, AString &target) |
| void | FormatByteSize (AString &target, uinteger byteSize, uint16_t magnitudeThreshold, char unitSeparator, ByteSizeUnits unit, NumberFormat &nf) |
Variable Index: | |
| NumberFormat * | BYTESIZE_NUMBER_FORMAT |
|
strong |
Enumeration of byte-size units to output with types ByteSizeIEC and ByteSizeSI.
The unit symbols are read from the resources of module class alib::BASECAMP. The list is given with resource name BS.
Definition at line 14 of file bytesize.hpp.
|
strong |
Enumeration of exceptions thrown with classes found in sub-namespace alib::format of module ALib Format.
| Enumerator | |
|---|---|
| ArgumentIndexIs0 | Argument index '0' not allowed. |
| ArgumentIndexOutOfBounds | Argument index greater than number of arguments available. |
| IncompatibleTypeCode | Incompatible type code given argument type found. |
| MissingClosingBracket | Thrown by FormatterPythonStyle: Closing bracket |
| MissingPrecisionValuePS | Thrown by FormatterPythonStyle: Missing precision integral value after |
| DuplicateTypeCode | Thrown by FormatterPythonStyle: Duplicate type code. |
| UnknownTypeCode | Thrown by FormatterPythonStyle: Unknown type code. |
| ExclamationMarkExpected | Thrown by FormatterPythonStyle: Expected |
| UnknownConversionPS | Thrown by FormatterPythonStyle: Unknown conversion after |
| PrecisionSpecificationWithInteger | Thrown by FormatterPythonStyle: Precision specification not allowed with integer types. |
| MissingReplacementStrings | Thrown by FormatterPythonStyle: Missing replacement strings after conversion |
| NegativeValuesInBracketsNotSupported | Thrown by FormatterJavaStyle: Formatting of negative values in brackets is not supported. |
| MissingPrecisionValueJS | Thrown by FormatterJavaStyle: Missing precision integral value after |
| HexadecimalFloatFormatNotSupported | Thrown by FormatterJavaStyle: Output of floating point values in hexadecimal format not supported. |
| NoAlternateFormOfConversion | Thrown by FormatterJavaStyle: The alternate form '#"'" is not supported with given conversion. |
| NoPrecisionWithConversion | Thrown by FormatterJavaStyle: Precision specification is not supported with given conversion. |
| UnknownDateTimeConversionSuffix | Thrown by FormatterJavaStyle: Unknown conversion suffix with data/time conversion. |
| UnknownConversionJS | Thrown by FormatterJavaStyle: Unknown conversion character. |
| UnknownPropertyInFormatString | Thrown by constructor of PropertyFormatter when a property identifier parsed from the format string has no corresponding entry in the TCallbackTable provided. |
| ErrorInResultingFormatString | Exception entry added in method void Format(AString&, const Box&) when the underlying formatter throws. |
| MissingConfigurationVariable | Thrown by void Format(AString&, TVariables, TFormattable&) if a configuration variable cannot be loaded or is empty.
|
| UnknownMarker | Thrown by Paragraphs & AddMarked(const BoxedObjects& ...) when an unknown marker token was found. |
| EndmarkerWithoutStart | Thrown by Paragraphs & AddMarked(const BoxedObjects& ...) when a property identifier parsed from the format string has no corresponding entry in the TCallbackTable provided. |
Definition at line 14 of file fmtexceptions.hpp.
| void alib::format::FFormat_CallerInfo | ( | const Box & | self, |
| const String & | formatSpec, | ||
| NumberFormat & | nf, | ||
| AString & | target ) |
Implementation of FFormat for boxable type FMTCallerInfo.
Writes the content of box (which is of type CallerInfo) to the given AString object target using a local instance of class FMTCallerInfo and its method AString & Format(Substring, AString&, lang::CurrentData) const.
If parameter formatSpec is empty, a default format string defined by string resource of key "FMTCI" is used. This resource by default evaluates to
"[@ sf:sl from ''ya'' by ''ta'']"which results in the same output that is generated if an instance of class CallerInfo is simply appended to an AString, what in turn is defined with functor AppendableTraits<lang::CallerInfo, TChar, TAllocator>.
| self | The box that the function was invoked on. |
| formatSpec | The specification of the format. |
| nf | A copy of the number format of the formatter (allowed to be modified). |
| target | The AString object receiving the formatted string. |
| void alib::format::FFormat_DateTime | ( | const Box & | self, |
| const String & | formatSpec, | ||
| NumberFormat & | nf, | ||
| AString & | target ) |
Implementation of FFormat for boxable type DateTime.
Writes the content of box (which is of type DateTime) to the given AString object target using a local instance of class CalendarDateTime and its method Format.
If parameter formatSpec is empty, a default format string defined by string resource of key "FMTDT" is used.
| self | The box that the function was invoked on. |
| formatSpec | The specification of the format. |
| nf | A copy of the number format of the formatter (allowed to be modified). |
| target | The AString object receiving the formatted string. |
| void alib::format::FormatByteSize | ( | AString & | target, |
| uinteger | byteSize, | ||
| uint16_t | magnitudeThreshold, | ||
| char | unitSeparator, | ||
| ByteSizeUnits | unit, | ||
| NumberFormat & | nf ) |
This namespace function searches the next "fitting" magnitude of a given byteSize, so that it can be expressed as a floating point between 0 and 999, hence with three digits. The function is used for appending byte sizes to class AString. Helper-types ByteSizeIEC and ByteSizeSI allow the convenient use of this method in combination with AString objects and with parameter lists of ALib formatter functions. When using these helpers, singleton BYTESIZE_NUMBER_FORMAT is used.
| target | The target string. |
| byteSize | The value to print. |
| magnitudeThreshold | The lowest value to use with the next lower possible magnitude. If, for example, to 900, then 0.9 GiB is preferred over 900.0 MiB. |
| unitSeparator | If not '\0', this character is printed after the number and before the unit. |
| unit | The unit system to convert to. This parameter must be set to either IEC or SI. Other values are undefined behavior. |
| nf | The number format object to use. |
|
extern |
The NumberFormat singleton used with appending instances of structs ByteSizeIEC and ByteSizeSI to AString objects. The object is allocated in the GLOBAL_ALLOCATOR during bootstrapping.
Fields of interest here, are DecimalPointChar, which is copied during bootstrap from Global, and FractionalPartWidth which is set to 1 during bootstrap.