OpendTect-6_4  6.4
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
NrBytesToStringCreator Class Reference

Public Types

enum  Unit {
  Bytes =0, KB =1, MB =2, GB =3,
  TB =4, PB =5
}
 

Public Member Functions

 NrBytesToStringCreator ()
 
 NrBytesToStringCreator (uint64_t nrbytes)
 
void setUnitFrom (uint64_t number, bool maximum=true)
 
FixedString getString (uint64_t number, int nrdecimals=2, bool withunit=true) const
 
FixedString getUnitString () const
 

Static Public Member Functions

static FixedString toString (Unit)
 

Protected Attributes

Unit unit_
 

Detailed Description

Converts integer with number of bytes to a string with KB, GB or similar unit.

Member Enumeration Documentation

Enumerator
Bytes 
KB 
MB 
GB 
TB 
PB 

Constructor & Destructor Documentation

NrBytesToStringCreator::NrBytesToStringCreator ( )
NrBytesToStringCreator::NrBytesToStringCreator ( uint64_t  nrbytes)

Unit is set from nrbytes

Member Function Documentation

FixedString NrBytesToStringCreator::getString ( 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.

FixedString NrBytesToStringCreator::getUnitString ( ) const
void NrBytesToStringCreator::setUnitFrom ( uint64_t  number,
bool  maximum = true 
)

Sets the unit (B, KB, MB, GB, TB) based on the number.

Parameters
maximumwill only change unit if a larger unit is needed.
static FixedString NrBytesToStringCreator::toString ( Unit  )
static

Member Data Documentation

Unit NrBytesToStringCreator::unit_
protected

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019