#include <format.hpp>
This is a type purely made to be appended to objects of type AString. Various constructors accept integer and floating point values, along with formatting options. The specialization of functor T_Append will use a given (or defaulted) instance of class NumberFormat to format the encapsulated value and append the result to the AString in question.
Inner Types:
Besides accepting plain number types, this class in addition aggregates several public inner types, namely
Each of these classes provide certain formatting options, which are implemented by a corresponding specialization of functor T_Append.
Details on Formats:
Details on the options of formatting integer and floating point numbers are documented with class NumberFormat.
TChar | The character type. Alias names for specializations of this class using character types character, nchar, wchar, xchar, complementChar and strangeChar are provided in namespace aworx with type definitions Format, NFormat, WFormat, XFormat, ComplementFormat and StrangeFormat. |
Definition at line 84 of file format.hpp.
Inner Classes | |
struct | Bin |
struct | Escape |
struct | Field |
struct | Hex |
struct | Oct |
struct | Tab |
Public Fields | |
TNumberFormat< TChar > * | nf |
union { | |
double fpValue | |
The value when using constructor with type double. | |
int64_t value | |
The value when using constructor with signed integer types. | |
} | v |
The data. More... | |
int | valueType |
Flag witch value to use (1= sInt, 2=uInt, 3=fp ) | |
int | width |
Public Methods | |
template<typename T > | |
TFormat (T value, int overrideWidth=0, TNumberFormat< TChar > *numberFormat=nullptr) | |
template<typename T > | |
TFormat (T value, TNumberFormat< TChar > *numberFormat=nullptr) | |
|
inline |
Constructor. Stores parameters.
T | The type of argument value. Deduced by the compiler. Integer and floating-point types are accepted |
value | The value to write. |
overrideWidth | Defaults to 0 which denotes to choose the value of field NumberFormat::DecMinimumFieldWidth. |
numberFormat | The number format to use. Defaults to nullptr which chooses the static singleton found in NumberFormat::Computational. |
|
inline |
Alternative constructor that omits parameter width and set it to 0
.
T | The type of argument value. Deduced by the compiler. Integer and floating-point types are accepted |
value | The value to write. |
numberFormat | The number format to use. Defaults to nullptr which chooses the static singleton found in NumberFormat::Computational. |
TNumberFormat<TChar>* nf |
The number format to use. Defaults to nullptr
which chooses the static singleton found in NumberFormat::Computational.
Definition at line 448 of file format.hpp.
union { ... } v |
The data.
The union to hold an integral or floating point value provided with the different constructors.
int width |
The minimum width of the number to write. Defaults to 0
which denotes to choose the value of field NumberFormat::DecMinimumFieldWidth.
Definition at line 452 of file format.hpp.