This struct is used to format sizes of byte arrays (streams, files, etc), in accordance with IEC units (KiB, MiB, GiB, etc). Integral values embedded in this struct are appendable to class AString.
Definition at line 92 of file bytesize.inl.
Public Field Index: | |
uint16_t | MagnitudeThreshold |
char | UnitSeparator |
An optional character to separate the number from the unit. | |
uinteger | Value |
The encapsulated value to print. | |
Public Method Index: | |
constexpr | ByteSizeIEC (uinteger value, uint16_t magnitudeThreshold=8 *1024/10, char unitSeparator='\0') noexcept |
ALIB_DLL double | ConvertTo (ByteSizeUnits unit) |
ALIB_DLL std::pair< double, ByteSizeUnits > | GetMagnitude () |
uint16_t alib::format::ByteSizeIEC::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.
Definition at line 95 of file bytesize.inl.
char alib::format::ByteSizeIEC::UnitSeparator |
An optional character to separate the number from the unit.
Definition at line 98 of file bytesize.inl.
uinteger alib::format::ByteSizeIEC::Value |
The encapsulated value to print.
Definition at line 94 of file bytesize.inl.
|
inlineconstexprnoexcept |
Constructor.
value | The value to append/format. |
magnitudeThreshold | Stored in MagnitudeThreshold. Defaults to 8*1024/10 . |
unitSeparator | Separation character between printed number and unit. Defaults to 0 . |
Definition at line 105 of file bytesize.inl.
ALIB_DLL double alib::format::ByteSizeIEC::ConvertTo | ( | ByteSizeUnits | unit | ) |
ALIB_DLL std::pair< double, ByteSizeUnits > alib::format::ByteSizeIEC::GetMagnitude | ( | ) |
Evaluates the magnitude of the value and returns the converted double
value between 0.0
and threshold.
double
together with the magnitude flag.