Unit.cc
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00012 #include "zypp/base/String.h"
00013
00014 #include "zypp/base/Unit.h"
00015
00017 namespace zypp
00018 {
00019
00020 namespace base
00021 {
00022
00023 std::string Unit::form( double val_r,
00024 const std::string & symbol_r,
00025 unsigned field_width_r,
00026 unsigned unit_width_r,
00027 unsigned prec_r )
00028 {
00029 std::string ret = str::form( "%*.*f", field_width_r, prec_r, val_r );
00030 if ( unit_width_r )
00031 {
00032 ret += str::form( " %*s", unit_width_r, symbol_r.c_str() );
00033 }
00034 return ret;
00035 }
00036
00038 }
00041 }