strfmt.h File Reference

#include "asserts.h"
#include "types.h"
#include "estring.h"
#include "rmath.h"

Include dependency graph for strfmt.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

template<class T> std::string size_to_string (T a_t, const std::string &a_base_size_unit="b", uint16 a_width=8, uint16 a_precision=1, uint16 a_kilo=1024)
 Given an integral number, return a string with the number formatted as a human-readable machine-type size.

template<class T> std::string num_to_string (T a_t, uint16 a_width=0)
 Given an integral number, return a string with the number formatted in a generic, human-readable format.

template<class T> std::string throughput_to_string (T a_t, const std::string &a_base_size_unit="b", const std::string &a_base_time_unit="s", uint16 a_width=10, uint16 a_precision=1, uint16 a_kilo=1024)
 Given an integral number, return a string with the number formated as a number of machine-type size per second.

template<typename T> std::string percent_string (const T &a_complete, const T &a_total)
 Given a count complete and a count total, calculate a percentage.


Function Documentation

template<class T>
std::string num_to_string a_t,
uint16  a_width = 0
 

Given an integral number, return a string with the number formatted in a generic, human-readable format.

(Ex: 10240 becomes "10,240")

Definition at line 96 of file strfmt.h.

References estring::align(), estring::fmt_str(), TRY_nomem, and estring::width().

Referenced by test2().

Here is the call graph for this function:

template<typename T>
std::string percent_string const T &  a_complete,
const T &  a_total
 

Given a count complete and a count total, calculate a percentage.

Definition at line 157 of file strfmt.h.

References estring::align(), estring::fillchar(), estring::fmt_str(), estring::precision(), TRY, TRY_nomem, safe_num< T >::value(), and estring::width().

Referenced by vault_manager::delete_oldest_archive(), jobs_report::format_synopsis(), vault_manager::overflow(), test(), test4(), and vault_report::write_report().

Here is the call graph for this function:

template<class T>
std::string size_to_string a_t,
const std::string &  a_base_size_unit = "b",
uint16  a_width = 8,
uint16  a_precision = 1,
uint16  a_kilo = 1024
 

Given an integral number, return a string with the number formatted as a human-readable machine-type size.

(Ex: 10240 becomes "10Kb")

Definition at line 12 of file strfmt.h.

References TRY, TRY_nomem, and safe_num< T >::value().

Referenced by test1(), and throughput_to_string().

Here is the call graph for this function:

template<class T>
std::string throughput_to_string a_t,
const std::string &  a_base_size_unit = "b",
const std::string &  a_base_time_unit = "s",
uint16  a_width = 10,
uint16  a_precision = 1,
uint16  a_kilo = 1024
 

Given an integral number, return a string with the number formated as a number of machine-type size per second.

(Ex: 10240 becomes "10Kb/s")

Definition at line 135 of file strfmt.h.

References size_to_string(), and TRY_nomem.

Referenced by timer::bps(), and test3().

Here is the call graph for this function:


Generated on Mon Jul 12 12:04:51 2004 for rvm by doxygen 1.3.6