OpendTect
7.0
|
Public Types | |
enum | Unit { Bytes =0 , KB =1 , MB =2 , GB =3 , TB =4 , PB =5 } |
Public Member Functions | |
NrBytesToStringCreator () | |
NrBytesToStringCreator (std::uint64_t nrbytes) | |
StringView | getString (std::uint64_t number, int nrdecimals=2, bool withunit=true) const |
StringView | getUnitString () const |
void | setUnitFrom (std::uint64_t number, bool maximum=true) |
Static Public Member Functions | |
static StringView | toString (Unit) |
Protected Attributes | |
Unit | unit_ |
Converts integer with number of bytes to a string with KB, GB or similar unit.
<>
NrBytesToStringCreator::NrBytesToStringCreator | ( | ) |
NrBytesToStringCreator::NrBytesToStringCreator | ( | std::uint64_t | nrbytes | ) |
Unit is set from nrbytes
StringView NrBytesToStringCreator::getString | ( | std::uint64_t | number, |
int | nrdecimals = 2 , |
||
bool | withunit = true |
||
) | const |
Use string before doing anything else, as it will be overwritten at next call from same thread.
StringView NrBytesToStringCreator::getUnitString | ( | ) | const |
void NrBytesToStringCreator::setUnitFrom | ( | std::uint64_t | number, |
bool | maximum = true |
||
) |
Sets the unit (B, KB, MB, GB, TB) based on the number.
number | |
maximum | will only change unit if a larger unit is needed. |
|
static |
|
protected |
Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2024