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 |
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 &box, const String &formatSpec, NumberFormat &, AString &target) |
ALIB_API void | FormatByteSize (AString &target, uinteger byteSize, uint16_t magnitudeThreshold, char unitSeparator, ByteSizeUnits unit, NumberFormat &nf) |
Variable Index: | |
NumberFormat * | BYTESIZE_NUMBER_FORMAT = 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 30 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 cannot 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 20 of file fmtexceptions.hpp.
ALIB_API void 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 FMTCallerInfo::Format.
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 T_Append<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. |
Definition at line 28 of file fmtcallerinfo.cpp.
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 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. |
NumberFormat * BYTESIZE_NUMBER_FORMAT = nullptr |
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 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 72 of file basecamp.cpp.