#include <Unit.h>
Public Types | |
typedef long long | ValueType |
Public Member Functions | |
Unit () | |
Default ctor. | |
Unit (ValueType factor_r, std::string symbol_r, unsigned prec_r) | |
ctor | |
ValueType | factor () const |
const std::string & | symbol () const |
unsigned | prec () const |
std::string | form (ValueType val_r, unsigned field_width_r=0, unsigned unit_width_r=1) const |
Build string representation of val_r. | |
std::string | form (ValueType val_r, unsigned field_width_r, unsigned unit_width_r, unsigned prec_r) const |
Static Public Member Functions | |
static std::string | form (double val_r, const std::string &symbol_r, unsigned field_width_r, unsigned unit_width_r, unsigned prec_r) |
Private Attributes | |
ValueType | _factor |
std::string | _symbol |
unsigned | _prec |
Unit strores factor and symbol, and a precision value for printing. form builds a string from a value according to the format specification.
static const Unit B( 1, "B", 0 ); static const Unit K( 1024, "K", 1 ); static const Unit M( 1048576, "M", 1 ); static const Unit G( 1073741824, "G", 2 ); static const Unit T( 1099511627776, "T", 3 );
Definition at line 42 of file Unit.h.
|
|
|
Default ctor.
|
|
ctor
|
|
Definition at line 60 of file Unit.h. References _factor. Referenced by zypp::ByteCount::bestUnit(), and zypp::ByteCount::bestUnit1000(). |
|
Definition at line 63 of file Unit.h. References _symbol. |
|
Definition at line 66 of file Unit.h. References _prec. Referenced by zypp::ByteCount::asString(). |
|
Build string representation of val_r.
Definition at line 70 of file Unit.h. References _prec. Referenced by zypp::ByteCount::asString(), and form(). |
|
|
|
Definition at line 23 of file Unit.cc. References zypp::str::form(). |
|
|
|
|
|
|