libzypp
10.5.0
|
00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 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 } // namespace base 00041 } // namespace zypp