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 template <typename TAppendable, typename TChar, typename TAllocator> AppendableTraits will use a given (or defaulted) instance of class NumberFormat to format the encapsulated value and append the result to the AString in question.
1234.56
1.234,56
Details on Formats:
Details on the options of formatting integer and floating point numbers are documented with class NumberFormat.
| TChar | The character type of the AString that instances can be "applied" to. |
Definition at line 49 of file format.inl.
Public Field Index: | |
| TNumberFormat< TChar > * | nf |
| union { | |
| double fpValue | |
| The value when using constructor with type double. More... | |
| int64_t value | |
| The value when using constructor with signed integer types. More... | |
| } | v |
| The data. | |
| int | valueType |
| Flag witch value to use (1= sInt, 2=uInt, 3=fp ). | |
| int | width |
Public Method Index: | |
| template<typename TFloat> | |
| TDec (TFloat value, int overrideWidth=0, TNumberFormat< TChar > *numberFormat=nullptr) | |
| template<typename TFloat> | |
| TDec (TFloat value, TNumberFormat< TChar > *numberFormat=nullptr) | |
| template<typename TIntegral> | |
| TDec (TIntegral value, int overrideWidth=0, TNumberFormat< TChar > *numberFormat=nullptr) | |
| template<typename TIntegral> | |
| TDec (TIntegral value, TNumberFormat< TChar > *numberFormat=nullptr) | |
| double alib::strings::TDec< TChar >::fpValue |
The value when using constructor with type double.
Definition at line 57 of file format.inl.
| TNumberFormat<TChar>* alib::strings::TDec< TChar >::nf |
The number format to use. Defaults to nullptr which chooses the static singleton found in NumberFormat::Computational.
Definition at line 60 of file format.inl.
| union { ... } alib::strings::TDec< TChar >::v |
The data.
The union to hold an integral or floating point value provided with the different constructors.
| int64_t alib::strings::TDec< TChar >::value |
The value when using constructor with signed integer types.
Definition at line 56 of file format.inl.
| int alib::strings::TDec< TChar >::valueType |
Flag witch value to use (1= sInt, 2=uInt, 3=fp ).
Definition at line 67 of file format.inl.
| int alib::strings::TDec< TChar >::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 64 of file format.inl.
|
inline |
Constructor. Stores parameters.
| TIntegral | The type of argument value. Deduced by the compiler. Only integral values 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. |
Definition at line 80 of file format.inl.
|
inline |
Alternative constructor that omits parameter overrideWidth and set it to 0.
| TIntegral | The type of argument value. Deduced by the compiler. Only integral values 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. |
Definition at line 97 of file format.inl.
|
inline |
Constructor. Stores parameters.
| TFloat | The type of argument value. Deduced by the compiler. Only floating-point values 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. |
Definition at line 115 of file format.inl.
|
inline |
Alternative constructor that omits parameter overrideWidth and set it to 0.
| TFloat | The type of argument value. Deduced by the compiler. Only floating-point values 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. |
Definition at line 131 of file format.inl.