ALib C++ Framework
by
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::format::ByteSizeIEC Struct Reference

Description:

This struct is used to format sizes of byte arrays (streams, files, etc), in accordance with IEC units which are based on 1024 bytes (KiB, MiB, GiB, etc). Integral values embedded in this struct are appendable to class AString.

See also
Sibling struct ByteSizeSI

Definition at line 93 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
double ConvertTo (ByteSizeUnits unit)
std::pair< double, ByteSizeUnitsGetMagnitude ()

Field Details:

◆ MagnitudeThreshold

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 96 of file bytesize.inl.

◆ UnitSeparator

char alib::format::ByteSizeIEC::UnitSeparator

An optional character to separate the number from the unit.

Definition at line 99 of file bytesize.inl.

◆ Value

uinteger alib::format::ByteSizeIEC::Value

The encapsulated value to print.

Definition at line 95 of file bytesize.inl.

Constructor(s) / Destructor Details:

◆ ByteSizeIEC()

alib::format::ByteSizeIEC::ByteSizeIEC ( uinteger value,
uint16_t magnitudeThreshold = 8*1024/10,
char unitSeparator = '\0' )
inlineconstexprnoexcept

Constructor.

Parameters
valueThe value to append/format.
magnitudeThresholdStored in MagnitudeThreshold. Defaults to 8*1024/10.
unitSeparatorSeparation character between printed number and unit. Defaults to 0.

Definition at line 106 of file bytesize.inl.

Method Details:

◆ ConvertTo()

double alib::format::ByteSizeIEC::ConvertTo ( ByteSizeUnits unit)

Returns a double value converted to the given unit. Note that while this class otherwise is responsible for IEC units, conversions to SI-units may be requested.

Parameters
unitThe unit to convert to.
Returns
Field Value as a double converted to unit.

◆ GetMagnitude()

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.

Returns
The Value converted to double together with the magnitude flag.

The documentation for this struct was generated from the following file: