This is the reference documentation of sub-namespace format of module ALib BaseCamp .
Extensive documentation for this namespace is provided with chapter 4. Namespace alib::lang::format of the Programmer's Manual of that module.
Type Index: | |
struct | ByteSizeIEC |
struct | ByteSizeSI |
struct | FFormat |
class | Formatter |
class | FormatterJavaStyle |
class | FormatterPythonStyle |
class | FormatterStdImpl |
class | Paragraphs |
class | PropertyFormatter |
struct | PropertyFormatterMapAppendable |
class | PropertyFormatters |
Function Index: | |
ALIB_API void | FormatByteSize (AString &target, uinteger byteSize, uint16_t magnitudeThreshold, char unitSeparator, ByteSizeUnits unit, NumberFormat &nf) |
Variable Index: | |
NumberFormat * | ByteSizeNumberFormat = nullptr |
enum ByteSizeUnits : uint8_t |
Enumeration of byte-size units to output with types ByteSizeIEC and ByteSizeSI .
The unit symbols are read from the resources of module class BaseCamp . The list is given with resource name BS.
Definition at line 46 of file bytesize.hpp.
|
strong |
Enumeration of exceptions thrown with classes found in sub-namespace alib::lang::format of module ALib BaseCamp .
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 PropertyFormatter::Format when the underlying formatter throws. |
MissingConfigurationVariable | Thrown by PropertyFormatters::Format if a configuration variable can not be loaded or is empty.
|
UnknownMarker | Thrown by Paragraphs::AddMarked when an unknown marker token was found. |
EndmarkerWithoutStart | Thrown by Paragraphs::AddMarked when a property identifier parsed from the format string has no corresponding entry in the TCallbackTable provided. |
Definition at line 22 of file fmtexceptions.hpp.
ALIB_API void 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 to class AString. Helper types ByteSizeIEC and ByteSizeSI allow the convient use of this method in combination with AString objects and with parameter lists of ALib formatter functions. When using these helpers, singleton ByteSizeNumberFormat 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 behaviour. |
nf | The number format object to use. |
NumberFormat * ByteSizeNumberFormat = nullptr |
The NumberFormat singleton used with appending instances of structs ByteSizeIEC and ByteSizeSI to AString objects. The object is allocated in the GlobalAllocator during bootstrapping of module ALib BaseCamp .
Fields of interest here, are DecimalPointChar , which is copied during bootstrap from NumberFormat::Global , and FractionalPartWidth which is set to 1
during bootstrap.
Definition at line 139 of file basecamp.cpp.